Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

How would you incorporate the void printReport(int v, int c, int d, int s); in the Code below using the pseduo code below as a

How would you incorporate the void printReport(int v, int c, int d, int s); in the Code below using the pseduo code below as a reference.

// Include necessary libraries // Prototype for writeReport goes here: ___ printReport( /* params */ ); int main() { // most of your code printReport( /* whatever you pass it */); // call the new function return 0; } ___ printReport( /* params */ ) { // Print the counts of vowels, consonants, digits, and special characters // If you do this right, the output shouldn't change at all }

And how would you incoprate these functions into the code as well a define these below:

Prototype: string getUserInput();

Prototype: bool isVowel(char c);

and call these :

  • getUserInput
  • isVowel
  • printReport

Here is what I have so far:

#include

#include

#include

using namespace std;

void printReport(int v, int c, int d, int s);

bool isVowel(char c);

int countVowels(const char *str);

int main()

{

string s;

cout<< "Enter a string" <

getline (cin,s);

cout<< s <

int vowels=0,consonants=0,digits=0,specialChar=0;

for (int i=0; i

char ch=s[i];

if (isalpha(s[i])!= 0){

s[i]= toupper(s[i]);

if (ch == 'a'|| ch == 'e'|| ch == 'i'|| ch == 'o' || ch == 'u')

vowels++;

else

consonants++;

}

else if (isdigit(s[i])!= 0)

digits++;

else

specialChar++;

}

cout<<"Vowels="<

cout<<"Consonants="<

cout<<"Digits="<

cout<<"Special Characters="<

return 0;

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases DeMYSTiFieD

Authors: Andy Oppel

2nd Edition

0071747990, 978-0071747998

More Books

Students also viewed these Databases questions