1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Usimov [2.4K]
3 years ago
14

Write a program that reads a string and outputs the number of times each lowercase vowel appears in it. Your program must contai

n a function with one of its parameters as a string variable and return the number of times each lowercase vowel appears in it. Also write a program to test your function. (Note that if str is a variable of type string, then str.at(i) returns the character at the ith position. The position of the first character is 0. Also, str.length() returns the length of the str, that is, the number of characters in str.)
Computers and Technology
1 answer:
kogti [31]3 years ago
3 0

Answer:

Here the code is given as follows,

Explanation:

#include <iostream>

#include <string>

using namespace std;

void Vowels(string userString);

int main()

{

   string userString;

   //to get string from user

   cout << "Please enter a string: ";

   getline(cin,userString,'\n');

   Vowels(userString);

   return 0;

}

void Vowels(string userString)

{

   char currentChar;

   //variables to hold the number of instances of each vowel

   int a = 0, e = 0, i = 0, o = 0, u = 0;  

   for (int x = 0; x < userString.length(); x++)  

   {

       currentChar = userString.at(x);

       switch (currentChar)  

       {

           case 'a':

               a += 1;

               break;

           case 'e':

               e += 1;

               break;

           case 'i':

               i += 1;

               break;

           case 'o':

               o += 1;

               break;

           case 'u':

               u += 1;

               break;

           default:

               break;

       }

   }

   // to print no of times a vowels appears in the string

   cout << "Out of the " << userString.length() << " characters you entered." << endl;

   cout << "Letter a = " << a << " times" << endl;

   cout << "Letter e = " << e << " times" << endl;

   cout << "Letter i = " << i << " times" << endl;

   cout << "Letter o = " << o << " times" << endl;

   cout << "Letter u = " << u << " times" << endl;

}

Hence the code and Output.

Please enter a string

Out of the 16 characters you entered.

Letter a = 2 times

Letter e = 1 times

Letter i = 0 times

Letter o = 1 times

Letter u = 0 times.

You might be interested in
. Find the supplements of : 150' and 70°​
suter [353]
30 is the supplement of 150
7 0
3 years ago
A user logs into Active Directory on a workstation and the user home directory does not redirect to a network share on a file se
inysia [295]

Answer:

gpresult

Explanation:

Group Policy provides the system administrator with settings that would be necessary to manage the different user accounts available in an organization. It also controls their work environment centrally by configuring the user Operating System (OS), applications and user accounts.

Group policy settings or configurations are referred to as Group Policy Objects (GPOs). These objects can be linked to organizational units (OUs), domains or sites.

There are various group policy commands such as;

  1. rstrui (System Restore tool will run),
  2. runas (using different permission to run a tool or program),
  3. tasklist (currently running programs are shown
  4. gpupdate (Group policies are refreshed)
  5. gpresult (group policy configurations are displayed for verification)

gpresult command can be used to verify the group policy configurations for adjustment or optimization. The technician can start troubleshooting from viewing the active settings, then running the rstrui to start the System Restore utility to restore the computer to an earlier date

6 0
3 years ago
Mikhail is working in an IDE and needs to test a program one step at a time to find and fix errors. What tool should he use?
FromTheMoon [43]

Answer:

c) De bug ger

Explanation:

Edge 2020

8 0
3 years ago
Please tell fast plzzzzzz.​
Vaselesa [24]

Answer:

false well if u know someone u can click it

6 0
3 years ago
The part of a screen that holds its own document or message.
scZoUnD [109]
The icons is the answer
8 0
3 years ago
Other questions:
  • In Asch’s study which of these lowered conformity rates
    7·2 answers
  • Nolan has just created a linked cell to another cell in a separate worksheet in his current Excel 2016 workbook.
    10·2 answers
  • Damage to which portion of the limbic system results in loss of memory of recent events and difficulty committing anything new t
    13·1 answer
  • Why is it a good idea to save work in the cloud
    10·2 answers
  • write an algorithm that gets two values: the price for item A and the quantity purchased. The algorithm should then print the to
    13·1 answer
  • What if you put a flashdrive in a iphone block and plug it in an outlet
    7·2 answers
  • The mechanism that establishes the medullary osmotic gradient depends most on the permeability properties of the ________. A. co
    5·1 answer
  • True or False: Mapping annotations are exclusive - an annotated method will only be accessible to requests sent to a matching UR
    14·1 answer
  • Which of the following are good ways to keep your information and your computer secure?
    10·2 answers
  • Why does your e-learning course need a title slide?
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!