Hello, i am wondering if there is a better way to have this same thing happen with out butchering this code:
Im refering to the "if statement" inside the while loop.Code://Race cout << "Race choices: human, elf\n"; cout << "Race: \n"; cin >> race; cin.ignore(100, '\n'); bool boolRace = 0; while((strcmp(race, "human")!=0)&&(boolRace == 0)) { if (strcmp(race, "elf")!=0) { cout << "YOU FAIL! \n...Race: \n"; cin >> race; cin.ignore(100, '\n'); } else { boolRace = 1; } } cout << "Name: " << charName << "\n" << "Race: " << race << "\n";
thanks
-Scott



LinkBack URL
About LinkBacks


