1 / 3

Argument List

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.

zalman
Download Presentation

Argument List

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Argument List

  2. #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; }

  3. 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; }

More Related