带参数的main函数
#include <iostream> #include <string> using namespace std; int main(int argc,char *argv[]){ cout << "Parameter num is :" << argc << endl; cout << "the command is :" << argv[0] << endl; cout << "Parameter list is: "<< endl; for(int i = 1; i < argc; i++){ cout << "No_"<< i << "parameter is :" << argv[i] << " "<< endl; } cout << endl; return 0; }