// factorial.c++ computes factorial, takes // command line argument // $ g++ -Wall factorial.c++ -o factorial #include using namespace std; #include int main(int count, char *vects[]) { int n, i, fact = 1 ; if(count < 2) { cerr << "Missing 2nd argument\n" ; return 0 ; } n = atoi(vects[1]) ; for(i=1; i<=n; ++i) fact *=i ; cout << n << "! = " << fact << endl; return 0 ; }