the program asks questions in the same order, how can i fix that?
for some questions any answer is seen as correct...?
int main()
{
char answer [20];
char ans = 'y';
cout <<"Do you know the nicknames of these colleges . . . \n";
cout <<"All the answers are plural (if possible), lowercase \n";
cout <<"and do not include the word 'the' \n\n.";
while(ans == 'y' || ans == 'Y')
{
int c=0, w=0;
while(w + c < 5)
{
int choice = randMid(1, 9);
if (choice == 1)
{
cout <<"What is the nickname of The University of Maryland?" << endl;
cin.getline(answer, 20, '\n');
if (strcmp(answer, "terps") || strcmp(answer, "terrapins"))
{
cout <<"Correct!" << endl << endl;
c++;
}
else
{
cout <<"Wrong" << endl << endl;
w++;
}
}
if (choice == 2)
{
cout <<"What is the nickname of Duke University?" << endl;
cin.getline(answer, 20, '\n');
if (strcmp(answer, "bluedevils") || strcmp(answer, "blue devils"))
{
cout <<"Correct!" << endl << endl;
c++;
}
else
{
cout <<"Wrong" << endl << endl;
w++;
}
}
if (choice == 3)
{
cout <<"What is the nickname of Georgia Tech University?" << endl;
cin.getline(answer, 20, '\n');
if (strcmp(answer, "yellowjackets") || strcmp(answer, "yellow jackets"))
{
cout <<"Correct!" << endl << endl;
c++;
}
else
{
cout <<"Wrong" << endl << endl;
w++;
}
}
if (choice == 4)
{
cout <<"What is the nickname of The University of Virginia?" << endl;
cin.getline(answer, 20, '\n');
if (strcmp(answer, "cavaliers"))
{
cout <<"Correct!" << endl << endl;
c++;
}
else
{
cout <<"Wrong" << endl << endl;
w++;
}
}
if (choice == 5)
{
cout <<"What is the nickname of North Carolina?" << endl;
cin.getline(answer, 20, '\n');
if (strcmp(answer, "tar heels") || strcmp(answer, "tarheels"))
{
cout <<"Correct!" << endl << endl;
c++;
}
else
{
cout <<"Wrong" << endl << endl;
w++;
}
}
if (choice == 6)
{
cout <<"What is the nickname of North Carolina State?" << endl;
cin.getline(answer, 20, '\n');
if (strcmp(answer, "wolfpack") || strcmp(answer, "wolf pack"))
{
cout <<"Correct!" << endl << endl;
c++;
}
else
{
cout <<"Wrong" << endl << endl;
w++;
}
}
if (choice == 7)
{
cout <<"What is the nickname of Florida State University?" << endl;
cin.getline(answer, 20, '\n');
if (strcmp(answer, "seminoles"))
{
cout <<"Correct!" << endl << endl;
c++;
}
else
{
cout <<"Wrong" << endl << endl;
w++;
}
}
if (choice == 8)
{
cout <<"What is the nickname of Clemson University?" << endl;
cin.getline(answer, 20, '\n');
if (strcmp(answer, "tigers") || strcmp(answer, "tiger"))
{
cout <<"Correct!" << endl << endl;
c++;
}
else
{
cout <<"Wrong" << endl << endl;
w++;
}
}
if (choice == 9)
{
cout <<"What is the nickname of Wake Forest University?" << endl;
cin.getline(answer, 20, '\n');
if (strcmp(answer, "deamon deacons") || strcmp(answer, "deamondeacons"))
{
cout <<"Correct!" << endl << endl;
c++;
}
else
{
cout <<"Wrong" << endl << endl;
w++;
}
}
}
cout <<"You got " << c <<" correct and " << w <<" wrong!" << endl << endl;
cout << "Do you want to run this program again? (Y or N) --> ";
cin >> ans;
}
return 0;
}
//creates a random number between a low number and high number
int randMid(int low, int high)
{
return low+rand()%(high-low+1);
}