Pastebin launched a little side project called HostCabi.net, check it out ;-)Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: Nattack on Feb 20th, 2012  |  syntax: C++  |  size: 0.38 KB  |  hits: 31  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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. }