I need to output the first name, middle initial and the last name. It is not working. I don't know where I got wrong.
Code:
#include<stdio.h>
#include<string.h>
#include<ctype.h>
/*
Yog R. Panta
Chapter#9: Lowercase to Uppercase
04/27/2005
*/
int main()
{
char letter;
printf("\Please enter 1 in the program to exit the program");
printf("\n-------------------------------------------------");
printf("\nPlease enter a letter: ");
fflush(stdout);
letter=getchar();
if (letter!='1')
{
while(letter!='1')
{
if(isalpha(letter)!=0)
{
letter=toupper(letter);
printf("\nValid Entry! The letter in uppercase is: ");
putchar(letter);
}
else if(isalpha(letter)!==0)
printf("\nSorry, Invalid Entry!");
getchar();
printf("\n\nEnter another letter: ");
fflush(stdout);
letter=getchar();
}
}
if(letter=='1')
printf("\nEnd of the program");
return 0;
}