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

>Helppppppppppppppppppppp i will kill my self soon
It will a waste of time to help you if you are going to kill yourself soon. What's the point of helping?
Now, if you change your mind about the minor problem, you could always make a stop to read the rules about how to post your code. You'll find that at the top of the page. Pay special attetion at the one that explains how to properly tag your code.
In case that all this is too much for you, and you can not take it any more. Be considerate.
Don't make much of a mess for others to clean after you kill yourself.

I see its now been 8 days since you originally made this thread and thankfully still have surviced (not killed yourself) :) I assume that was just an exaggeration -- would you like me to change the title of this thread ?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.