30 likes | 99 Views
Argument List. #include <iostream> #include <cstdlib> using namespace std; int main(int argc, char *argv[]) { int i; for (i=0; i< argc ; i++) cout<<"argv["<<i<<"]="<< argv[i] <<endl; system ("pause"); return EXIT_SUCCESS; }. C:>multiply 5 10. C:>multiply 5 10 50.
E N D
#include <iostream> #include <cstdlib> using namespace std; int main(int argc, char *argv[]) { int i; for (i=0; i<argc; i++) cout<<"argv["<<i<<"]="<<argv[i]<<endl; system ("pause"); return EXIT_SUCCESS; }
C:\>multiply 5 10 C:\>multiply 5 1050 #include <iostream> #include <cstdlib> using namespace std; int main(int argc, char * argv[]) { cout<<atoi(argv[1]) * atoi(argv[2]); return EXIT_SUCCESS; }