main()函数的参数是OS在运行程序时, 先从main()函数开始,
这时它会向main()函数传递一些值, 这是作为main()的"形参"会接受到了一些数据,
这些数据会会是写什么呢?
是不是不同的程序, 接受到的值不一样呢?
int main(int argc, char *argv[])
{
if(argc < 4)
{
cerr << "usage: " << argv[0] << " datafile datatype minsup [output]" << endl;
cerr << "datatype = 1 for Quest datagenerator binary" << endl;
cerr << "datatype = 2 for Quest datagenerator ascii" << endl;
cerr << "datatype = 3 for flat, i.e. all items per transaction on a single line" << endl;
cerr << "datatype = 4 for ascii version of Quest datagenerator binary" << endl;
}
else
{
FPgrowth *fpgrowth = new FPgrowth();
fpgrowth -> setData (argv[1],atoi(argv[2]));
fpgrowth -> setMinsup (atoi(argv[3]));
if(argc==5)
fpgrowth->setOutput(argv[4]);
clock_t start = clock();
int added = fpgrowth->mine();
cout << added << "\t[" << (clock()-start)/double(CLOCKS_PER_SEC) << "s]" << endl;
if(argc==5)
cout << "Frequent sets written to " << argv[4] << endl;
delete fpgrowth;
}
return 0;
}
这是一个面向对象的main()函数, 里面的函数我已经看懂了.
但是不知道到底main()函数的形参得到了什么值?????
请赐教