#include
#include
using namespace std;
Int main (int arg c, char * * argv)
{
int a,b;
If (arg c! {
=3)cout<" The usage of "& lt;<" Op1, op2 "& lt; return 1;
}
A=atoi (argv [1]);
B=atoi (argv [2]);
coutreturn 0;
}
CodePudding user response:
You also post a questionCodePudding user response:
DOS s command line to run the program is input, by command.com in memory the DOS command interpreter (similar to the sh under Linux, bash) interpretive executionFor example:
Edit a1. TXT
Dir/a/w
Edit the. Exe is an external command, is a concrete application name, performed by the command.com call
Dir is command.com internal command, directly to perform its part of the code
The parameters of the command is behind the command
Such as edit a1. TXT, arg c==2, argv [0]=="edit", argv [1]=="a1. TXT"
You can on the command line CMD (Win - R key combination, enter CMD running) running your program, the input parameters,
Under Windows 7 if you are using VC, if your program directory in D: \ \ C myprog1, executable file in D: \ \ C myprog1 \ Debug, you in the explorer window open D: \ \ C myprog1 folder, hold down the Shift key and then right-click on the Debug folder, right-click menu, select [in] here to open a command window, appears a black command window, enter: dir [enter] can see myprog1. Exe, input: myprog1 [enter] to run the program, input: myprog1 aa BBB [enter] to run the program with parameters, aa and BBB is two parameters,