i wrote a program with switch statements and now i have to write with while loop the same programram. Please say me where i am worng.
my if program:
char letter ;
printf("enter the antibiotic sample >>>>> ");
scanf("%c", &letter);
switch (letter)
{
case 'N':
case 'n':
printf("Perform standard tests 2, 3, and 4.Record results in notebook #3.\n");
break;
case 'P':
case 'p':
printf("Perform standard tests 1, 5.Record results in notebook #2\n");
break;
case 'B':
case 'b':
printf("Perform standard tests 1, 5.Record results in notebook #2 and \n Perform standard tests 2, 3, and 4.Record results in notebook #3. \n");
break;
case 'Z':
case 'z':
printf("Throw away sample\n");
break;
default:
printf("unknown class %c\n", letter);
printf("\n\n\n");
}
return 0;
}
and now i am sending my while program which supposed to be same function with another one
char letter;
while(scanf("%c", &letter) == 'N' || 'n' )
{
printf("Perform standard tests 2, 3, and 4.Record results in notebook #3.\n");
}
printf("enter the antibiotic sample >>>>> ");
while(scanf("%c", &letter) == 'P' || 'p')
{
printf("Perform standard tests 1, 5.Record results in notebook #2\n");
}
printf("enter the antibiotic sample >>>>> ");
while(scanf("%c", &letter) == 'B' || 'b')
{
printf("Perform standard tests 1, 5.Record results in notebook #2 and \n Perform standard tests 2, 3, and 4.Record results in notebook #3. \n");
}
while(scanf("%c", &letter) == 'Z' || 'z')
{
printf("Throw away sample\n");
}
please please help me about this