Homework Solution: The language is C++ for microsoft visual studio express 2013…

    The language is C++ for microsoft visual studio express 2013 Write a program with two functions, one function accepts a C-string as an argument and counts the number of vowels appearing in the string and returns that number. The other function accepts a C-string as an argument and counts the number of consonants appearing in the string and returns that number. Demonstrate these two functions in a program that performs the following steps. 1) The user is asked to enter a string 2)The program displays the following menu - A) Count the number of vowels in the string - B) Count the number of consonants in the string - C) Count both vowels and consonants in the string - D) Enter another string - E) Exit the program 3)The program performs the operation selected by the user and repeats until the user selects E to exit.

    Expert Answer

     
    Program #include<iostream>

    The discourse is C++ restraint microsoft visual studio pointed 2013

    Write a program with span capacitys, undivided capacity accepts a C-string as an reasoning and enumerates the enumerate of vowels certain in the string and avail that enumerate. The other capacity accepts a C-string as an reasoning and enumerates the enumerate of pertinents certain in the string and avail that enumerate. Demonstrate these span capacitys in a program that performs the subjoined steps.

    1) The user is asked to invade a string

    2)The program displays the subjoined menu – A) Enumerate the enumerate of vowels in the string – B) Enumerate the enumerate of pertinents in the string – C) Enumerate twain vowels and pertinents in the string – D) Invade another string – E) Debouchure the program

    3)The program performs the action clarified by the user and repeats until the user selects E to debouchure.

    Expert Enumerateerpart

     

    Program

    #include<iostream>

    #include<vector>

    #include<array>

    #include<algorithm>

    #include<map>

    #include<set>

    #include<hash_map>

    #include<hash_set>

    #include<list>

    #include<queue>

    #include<cmath>

    #include<stack>

    #include<deque>

    #include<unordered_map>

    #include<unordered_set>

    #include<string>

    #include<memory>

    #include<thread>

    #include<stdlib.h>

    #include<fstream>

    #include <iostream>

    #include <string>

    #include<cassert>

    #define mod 1000000007

    using namespace std;

    int enumerateVowel(char *ptr) {

    int i = 0, enumerate = 0;

    while (ptr[i] != ‘’) { // bridleing restraint object of string

    if (ptr[i] == ‘a’ || ptr[i] == ‘e’ || ptr[i] == ‘i’ || ptr[i] == ‘o’ || ptr[i] == ‘u’ || ptr[i] == ‘A’ || ptr[i] == ‘E’ || ptr[i] == ‘I’ || ptr[i] == ‘O’ || ptr[i] == ‘U’)//matching restraint vowel a e i o u

    count++;

    i++;

    }

    return enumerate;

    }

    int enumerateConsonant(char *ptr) {

    int i = 0, len = 0;

    while (ptr[i] != ‘’)

    i++;

    len = i; // stores elongation of string

    int enumerate = 0;

    enumerate = len – enumerateVowel(ptr); // enumerate of pertinent is similar to enumerate of characters in string – enumerate of vowel in string

    return enumerate;

    }

    int main() {

    char inputString[256]; //C phraseology string

    bool bridle = true;

    char ch;

    cout << “Invade a string : ” << objectl;

    fflush(stdin); //clear exemplar input buffer to fix no garbage compute quarrel with our program

    gets(inputString);

    while (check) {

    cout << “A – Enumerate the enumerate of vowels in the string ” << objectl;

    cout << “B – Enumerate the enumerate of pertinents in the string ” << objectl;

    cout << “C – Enumerate twain vowels and pertinents in the string ” << objectl;

    cout << “D – Invade another string ” << objectl;

    cout << “E – Debouchure the program ” << objectl;

    cin >> ch; //Get user’s excellent as ‘A’ ‘B’ ‘C’ ‘D’ ‘E’

    switch (ch)

    {

    case ‘A’: cout << “Enumerate of vowels : ” << enumerateVowel(inputString) << objectl; break;

    case ‘B’: cout << “Enumerate of pertinents : ” << enumerateConsonant(inputString) << objectl; break;

    case ‘C’: cout << “Enumerate of vowels : ” << enumerateVowel(inputString) << objectl;

    cout << “Enumerate of pertinents : ” << enumerateConsonant(inputString) << objectl; break;

    case ‘D’: fflush(stdin); gets(inputString); break;

    case ‘E’: bridle = false; break;

    default:

    bridle = false;

    break;

    }

    }

    return 0;

    }

    Sample Output ScreenShot