I have a program that is using command line arguments to tell the program what to do. So to run the program, you type in: main airports.txt SC PER, where SC is a different thing the program can do and PER is the code for a city. So PER is argv[3].
In a different class (Path), I have a section of code that looks like this:
void Path::scPrint() const {
cout << "*** Starting in " + scArg + " ***" << endl;
cout << "Print out of all flights starting in particular city" << endl;
}
I want the variable scArg to be the string stored in argv[3] -- in this case, PER. I can't work out how to do this. Currently in Main, I have this:
Path* path1 = new Path();
if (argv[2] = "SC") {
//scArg to be given value of argv[3] here
path1->scPrint();
}
Can anyone help me figure out what to do? Thanks so much in advance!