Hi, I'm making this simple program but i'm having a problem somewhere in Question 2. It doesn't prompt the user make an input. It is only the part where it does not prompt for user input.
Code:
#include <stdio.h>
main()
{
char answer1,answer2,answer3;
printf("*** QUIZ *** \n\n");
printf("Enter the letter of the correct answer.\n\n");
printf("Question 1: Choose the correct spelling.\n\n");
printf("\tA) Mississippi , B) Missisippi , C) Misissippi = ");
scanf("%c", &answer1);
if (answer1 == 'a' || answer1 == 'A')
{ printf("\nCorrect!\n\n");
}
else if (answer1 == 'b' || answer1 == 'B')
{ printf("Wrong!\n\n");
}
else if (answer1 == 'c' || answer1 == 'C')
{ printf("Wrong!\n\n");
}
else
{ printf("Invalid input!\n\n");
}
printf("Question 2: How many sides does a triangle have?\n\n");
printf("\tA) 33 , B) 3 , C) 13 = ");
scanf("%c", &answer2);
if (answer2 == 'a' || answer2 == 'A')
{ printf("\nWrong!\n\n");
}
else if (answer2 == 'b' || answer2 == 'B')
{ printf("Correct!\n\n");
}
else if (answer2 == 'c' || answer2 == 'C')
{ printf("Wrong!\n\n");
}
else
{ printf("Invalid input!\n\n");
}
printf("Question 3: 1000 + 1 = ?\n\n");
printf("\tA) 1100 , B) 1011 , C) 1001 = ");
scanf("%c", &answer3);
if (answer3 == 'a' || answer3 == 'A')
{ printf("\nWrong!\n\n");
}
else if (answer3 == 'b' || answer3 == 'B')
{ printf("Wrong!\n\n");
}
else if (answer3 == 'c' || answer3 == 'C')
{ printf("Correct!\n\n");
}
else
{ printf("Invalid input!\n\n");
}
system("pause");
}
=============
** this is what it shows when I tried to run it:
*** QUIZ ***
Enter the letter of the correct answer.
Question 1: Choose the correct spelling.
A) Mississippi , B) Missisippi , C) Misissippi = a
Correct!
Question 2: How many sides does a triangle have?
A) 33 , B) 3 , C) 13 = Invalid input!
Question 3: 1000 + 1 = ?
A) 1100 , B) 1011 , C) 1001 = v
Invalid input!
Press any key to continue . . .
============
thanks