/* mysum.cc -- * A program which sums the powers of positive integers * * Usage: mysum * * Created by: (author), Florida State University * Date: 4 Feb. 2008 */ #include #include using namespace std; long sumppi(int a, int b); int main(int argc, char *argv[]) { int a[2]; int sum; // read command line arguments for (int i = 1; i < argc ; i++) a[i-1] = atoi(argv[i]); // do the sum sum = sumppi(a[0],a[1]); //print results cout << "The sum of [1.." << a[0] << "] each raised to the power " << a[1] <<" is "<< sum << endl; return 0; }