The program runs just fine and works up until it reaches the first question "What is the capital city of Alabama?"... Instead of allowing user input, it immediately displays "That is wrong... the correct answer is montgomery". But then it proceeds to ask the question again, and this time it DOES request input. Everything from then on works perfectly, but i still can't figure out what i did wrong to cause the initial problem. The code is as follows:
string name;
string response;
string responseAlt;
int randchoice;
int counter(0);
string responseST;
string responseSTAlt;
int s1(0);
int s2(0);
int s3(0);
int s4(0);
int s5(0);
int s6(0);
int s7(0);
int s8(0);
int s9(0);
int s10(0);
int s11(0);
int s12(0);
int s13(0);
int s14(0);
int s15(0);
int s16(0);
int s17(0);
int s18(0);
int s19(0);
int s20(0);
int s21(0);
int s22(0);
int s23(0);
int s24(0);
int s25(0);
int s26(0);
int s27(0);
int s28(0);
int s29(0);
int s30(0);
int s31(0);
int s32(0);
int s33(0);
int s34(0);
int s35(0);
int s36(0);
int s37(0);
int s38(0);
int s39(0);
int s40(0);
int s41(0);
int s42(0);
int s43(0);
int s44(0);
int s45(0);
int s46(0);
int s47(0);
int s48(0);
int s49(0);
int s50(0);
cout<<"Welcome to the States And Capitals Quiz by MY_NAME\n\nWhat's your name? ";
getline (cin, name);
cout<<"\n\nHello "<<name<<"!"<<endl;
cout<<"\nWould you like to begin? ";
cin>>response;
responseAlt = response;
for(int i=0; responseAlt[i]; i++) responseAlt[i] = tolower(responseAlt[i]);
if (responseAlt == "yes"){
cout<<"\nGood...\n\n\n";
}
else {
cout<<"\nWell then- I'm gonna quiz you anyways...\n\n\n"<<endl;
}
while (counter < 50){
srand (time (NULL));
randchoice = rand () %50 + 1;
if (randchoice == 1) {
if (s1 == 0){
cout<<"What is the capital city of Alabama? ";
getline (cin, responseST);
responseSTAlt = responseST;
for(int z=0; responseSTAlt[z]; z++) responseSTAlt[z] = tolower(responseSTAlt[z]);
if(responseSTAlt == "montgomery"){
cout<<"\n\nThat is correct!\n\n";
}
else {
cout<<"\n\nThat is wrong... The correct answer is 'Montgomery'\n\n";
}