[Prompt the user to enter a sentence, then hit newline. Read the sentence one ch
ID: 3656206 • Letter: #
Question
[Prompt the user to enter a sentence, then hit newline. Read the sentence one character at a time, until you come to the newline character. Count the total number of keystrokes entered, the number of alphabetic characters, and the number of vowels ('a', 'e', 'i', 'o', and 'u'). Output these three counts] End Result should look like this : Keystrokes: 9999 Alpha Characters: 9999 Vowels: 9999 Only problem is when I insert a sentence... the CMD prompt does not continue... Any Help appreciated Please #include #include #include int main(int argc, char *argv[]) { int loop = 0; //Variable used for counting in the loop. int keystrokes = 0; //Counts number of keystrokes. int letters = 0; //Counts number of total letters. int vowels = 0;//Counts number of vowels. char sentence[9999]; //Defines the character array that will hold the input sentence. and fills it with the user's input. printf("Sentence Analyzer. "); printf("Input your sentence(s), then hit enter. "); scanf(" %c", &sentence); for(loop = 0; sentence[loop] != ' '; loop++) { if (sentence[loop] = 'a'||'e'||'i'||'u') { ++keystrokes; ++letters; ++vowels; } else { if (isalpha(sentence[loop]) == 1) { ++keystrokes; ++letters; } else { ++keystrokes; } } } printf("keystrokes%c ", keystrokes); printf("Alpha Characters %c ", letters); printf("Vowels %c", vowels); return 0; }Explanation / Answer
/*you may also download the code from.....http://www.2shared.com/file/9NEOieJb/VOWEL.html*/ #include#includeint main(int argc, char *argv[]) { int loop = 0; int keystrokes=0; int letters=0; int vowels=0; char sentence[99]; clrscr(); printf(" Sentence Analyzer."); printf(" Input your sentence(s), then hit enter. "); gets(sentence); while(sentence[loop]!='') { keystrokes++; if((sentence[loop]>='a' && sentence[loop]='A' && sentence[loop]Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.