Dear CProgramming administrators and members:
Good day everyone. I hope everybody is in good health upon reading this thread. Well, here's the code I've done recently (just sort of trying though):
The output seems fine, example, if I type apple then the output is You entered 2 vowel letters....but when I press Backspace, example I change my input to banana, then I noticed it just added the previous count to the vowels inside banana, Now there are five (5) vowel letters instead of just three (3). And if I press Backspace, the letters didn't erase, it will just be overwritten by my "other" input. I know the problem relies on the count if the program detected an A, E, I, O, U on the input, but I'm kind of stuck to the program, I mean, everytime I change leads to error, so I just hoping by consulting from this forum will help me how to solve my bugs, I will really appreciate any change you might feel on the code.Code:#include<stdio.h> #include<ctype.h> #define ENTERKEY '\r' int main(){ char buff[80]; char letter; char temp[80]; int count=0; clrscr(); printf("Please enter characters:"); do{ letter = getche(); letter = toupper(letter); if((letter=='A') | (letter=='E') | (letter=='I') | (letter=='O') | (letter=='U')) count++; else continue; }while(letter != ENTERKEY); printf("\n\nYou entered %d vowel letters.", count); getch(); return 0; }
Thank you so much guys and God bless everyone.
Respectfully yours,
MarkSquall