Command line arguments are used to pass values to the program during execution. This code shows you how to implement that in C++
#include<iostream> using namespace std; int main(int argc, char *argv[]){ cout<<"The Arguments are : "<<argv[1] <<" "<< argv[2]<<endl; return 0; }
The Arguments are : 1 2
g++ code.cpp
./a.out 1 2
Here 1 and 2 are commandline arguments.
Comments :