SHARE
TWEET

Untitled

Nattack Feb 20th, 2012 32 Never
  1. #include <cstdio>
  2. #include <iostream>
  3. #include <cstdlib>
  4.  
  5. using std::cout;
  6. using std::endl;
  7.  
  8. int main(int argc, char **argv)
  9. {
  10.     double sum=0;
  11.  
  12.     if(argc > 1)
  13.     {
  14.         for(int i = 1; i < argc; i++)
  15.             sum+= atof(argv[i]);
  16.         cout<< "Sum is " << sum << endl;
  17.     } else {
  18.         cout<< "No numbers" << endl;
  19.     }
  20.     return 0;
  21. }
RAW Paste Data
Top