create a program (by c language code) that will accept the user input (either m or f). the program will display "Hello miss" if input is "m" else if "f" then display "hello mam" . If "m" or "f" is not detected by the program then display "error".
C program click for details?
#include%26lt;stdlib.h%26gt;
#include%26lt;conio.h%26gt;
#include%26lt;stdio.h%26gt;
int main()
{
chr menu;
menu=getch();
switch(menu){
case 'm':
printf("Hello miss");
break;
case 'f':
printf("Hello mam");
break;
default:
printf("error");
}
return 0;
}
Reply:Not going to write the code but:
get the char
if( char=='m')
output ("%c hello miss")
else
if( char=='f')
output ("%c hello maam")
else
output ("%c ERROR")
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment