How to run this while loop?

char choice;
while (choice !='E')
{
printf("(A)");
printf("(B)");
printf("(C)");
printf("(D)");
printf("(E) Quit");
printf("ENTER CHOICE : ");
scanf("%c", &choice);
if (choice =='A')
{printf("A");}
else if (choice =='B')
{printf("B");}
else if (choice =='C')
{printf("C");}
else if (choice =='D')
{printf("D");}
else
{printf("Error Input");}
}


Any problem with this? the printf all should put where to make the program run?Need help really.
I done see much of a code problem, a tip to go to the next line to make your options and output visible and just to test lower case as well,

if choice == 'A' || choice == 'a'

☺☻

Oh I'm a c++ so I used cin>>choice; not sure much on scanf for c
Last edited on
Topic archived. No new replies allowed.