OK, what's wrong with this?
int main(int argc, char* argv[1]) { //declare argc and argv to check command-line arguments
string arg = argv[1]; //convert char to string
if (argc == 2) { //test if arg was entered
if (arg == "test") { //test if arg is 'test'
printf("you entered the arg 'test'. \n");
else
printf("you didn't enter the arg 'test'. \n");
}
else
printf("you entered no args. \n");
}
return 0;
}
g++ compiler complains a lot about my placement of the else's and }'s... I can't figure it out, besides putting an else before the nested if, but I want the nested if to be executed if the first one returns TRUE, not false...
Thank you very much in advance for any help!