Question: 4.26 Checkpoint A: Traversing a string and analyzing its characters Given a line of text as input, output the number of Vowels, Consonants, Digits and

4.26 Checkpoint A: Traversing a string and analyzing its characters

Given a line of text as input, output the number of Vowels, Consonants, Digits and Special characters.

Definitions:

  • A consonant is any alphabetic character that's not a vowel
  • A special character is any character that is neither alphabetic nor a digit.

Ex: If the input is:

Fallis@wesomein$onomaCounty! 

the output is:

Vowels: 11 Consonants: 14 Digits: 0 Special characters: 3 

Hint 1: Use character functions (section 3.14) to determine if character c is alphabetic (a-z or A-Z) or a decimal digit ('0' through '9').

Hint 2: To count vowels, you're going to have to compare to each of A/a, E/e, I/i, O/o, and U/u. That's ten comparisons, but you can cut it down to 5 if you convert the character to uppercase/lowercase first. Make SURE you understand this, and ask for help if you don't.

#include using namespace std;

int main() {

/* Type your code here. */

return 0; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!