(Solved) : Topic Array C String Write Program Asks User Enter String Characters Computes Displays Num Q42697703 . . .

Topic: Array and C String

Write a program that asks user to enter a string ofcharacters, then computes and displays the number of occurrences ofthe vowel letters ‘a’, ‘e’, ‘i’, ‘o’, ‘u’, and ‘A’, ‘E’, ‘I’, ‘O’,’U’ without case sensitivity, i.e. using one single count for both’a’ and ‘A’.

Code must use an integer array (size 5) to store theoccurrence counts.

Code must use a character array (size 300) to storeinput string. Each user input can be up to 299characters.

Hint:

   1- Use getline to read input into acharacter array. Size of character array should be 1 more than themaximum input size because it needs to be terminated by a(invisible) NULL character.

   The getline() function automaticallyputs a NULL character after the last character that itreads.

   2- Use Sentinel loop to acceptmultiple input until input string length is 0 (empty string “” whenuser hits Return)

   3- To get the length of a C string(that is a null-terminated character array), you can use thestrlen() function if you include “cstring” library. Empty C stringwill have a length of 0.

   

Test input strings

HellO JavA.

Some miscellanEous IssUes At schoOl.

C++ is grEat languagE.

Output sample

This program counts the vowel occurrences in input phrase Enter a phrase and hit Enter (maximum length 299): Hello Java. Vowe

This program counts the vowel occurrences in input phrase Enter a phrase and hit Enter (maximum length 299): Hello Java. Vowel Count i – 0 – I 0 Total of vowels is 4 Vowel with highest occurrence is A Enter a phrase and hit Enter (maximum length 299): Some miscellaneous Issues At school. Vowel Count O 0-0 OH O Total of vowels is 14 Vowel with highest occurrence is E Enter a phrase and hit Enter (maximum length 299): C++ is great language. Vowel Count a – A le – E i -I Total of vowels is 7 Vowel with highest occurrence is A Enter a phrase and hit Enter (maximum length 299): Process returned 0 (0x0) execution time : 59.908 si Press any key to continue. Show transcribed image text This program counts the vowel occurrences in input phrase Enter a phrase and hit Enter (maximum length 299): Hello Java. Vowel Count i – 0 – I 0 Total of vowels is 4 Vowel with highest occurrence is A Enter a phrase and hit Enter (maximum length 299): Some miscellaneous Issues At school. Vowel Count O 0-0 OH O Total of vowels is 14 Vowel with highest occurrence is E Enter a phrase and hit Enter (maximum length 299): C++ is great language. Vowel Count a – A le – E i -I Total of vowels is 7 Vowel with highest occurrence is A Enter a phrase and hit Enter (maximum length 299): Process returned 0 (0x0) execution time : 59.908 si Press any key to continue.

Expert Answer


Answer to Topic: Array and C String Write a program that asks user to enter a string of characters, then computes and displays the…

Leave a Comment

About

We are the best freelance writing portal. Looking for online writing, editing or proofreading jobs? We have plenty of writing assignments to handle.

Quick Links

Browse Solutions

Place Order

About Us