#include < iostream >
using namespace std;
int main(int argc,char **argv){
for(int i=0;i < argc ; i++)
cout << "Argument " << i << " is " << argv[i] << endl;
return EXIT_SUCCESS;
}
當透過Dos模式呼叫test.exe時,如果需要傳入參數,可傳入以下指令
test.exe hello! this is a test!
結果如下:

沒有留言:
張貼留言