So this code is for a command input to be entered in any random order and it will return the value that comes after your input. Amt_Range is a digit checking function.
Why does this work. It should be able to due to the pointer comparison.??
More importantly what does the string() do. By my limited understanding the comparison should not work because a c style string is in the form '-' 't'. Thanks in advance!!
int main(int argc, const char *argv[]) {
string dummy;
int tests = 0, quizzes = 0, assignments = 0, labs = 0, fin = 0;
int testweight = 0, quizweight = 0, assignweight = 0, labweight = 0, finweight = 0;
int counter = 1;
if (argv[counter] == string("-t")) {
dummy = argv[counter + 1];
tests = Amt_Range(dummy, "tests");
counter+=2;
} else if (argv[counter] == string("-q")) {
dummy = argv[counter + 1];
quizzes = Amt_Range(dummy, "quizzes");
counter+=2;
} else if (argv[counter] == string("-a")) {
dummy = argv[counter + 1];
assignments = Amt_Range(dummy, "assignments");
counter+=2;
} else if (argv[counter] == string("-l")) {
dummy = argv[counter + 1];
labs = Amt_Range(dummy, "labs");
counter+=2;
} else if (argv[counter] == string("-f")) {
dummy = argv[counter + 1];
fin = Amt_Range(dummy, "whether there is a final");
counter+=2;
} else {
cout << "wrong input NOW START OVER" << endl;
exit(EXIT_FAILURE);
}
}