argc是参数个数;
argv[0]是程序名,argv[1]是第一个参数;
如果输入osgptr1 x ,osgptr1是程序名,argc是2;
不算程序名,实际的参数个数是argc-1;
#include <iostream>using namespace std;int main(int argc, char* argv[])
{int cscnt = 0;cscnt = argc;cout << "程序名:" << argv[0] << endl;cout << "参数:" << endl;for (int i = 1; i < argc; i++){cout << argv[i] << endl;}cout << "参数个数:" << argc - 1 << endl;return 0;
}