INT main (int Argc, char ** argv)

xiaoxiao2021-03-05  54

#include

#include

/ * Argc is the number of external command parameters, and Argv [] is stored for each parameter content * /

Int main (int Argc, char * argv [])

{

INT A, B, C;

IF (argc == 1 || argc> 3)

Return 0;

COUT << "argc =" << argc << endl;

COUT << "argv [0] =" << argv [0] << endl;

COUT << "argv [1] =" << argv [1] << endl;

COUT << "argv [2] =" << argv [2] << endl;

A = ATOI (Argv [1]);

B = ATOI (Argv [2]);

C = a b;

COUT << "a =" << a << endl;

COUT << "b =" << b << endl;

COUT << "A B =" << c << endl;

Return 0;

}

appendix:

Compilation method under Visual C 6.0:

Project / setting ... / debug / program argument: Input 10 20

转载请注明原文地址:https://www.9cbs.com/read-32948.html

New Post(0)