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
Fynjy0 [20]
4 years ago
6

Write a program that prompts the user to input a sequence of characters and outputs the number of vowels.(Use the function isVow

el written in Programming Exercise 2.)Your output should look like the following:There are # vowels in this sentence.... where # is the number of vowels.here is what i have so far:#include #include using namespace std;//functions declaredbool isVowel(char ch);int main (){string letters;int num = 0;int len;cout<<"Enter a sequence of characters: ";getline(cin, letters);len = letters.length();for (int i = 0; i < len; i++){if (isVowel(letters[i]))num++;}if (num == 0)cout << "There were 0 vowels.\n";else if (num == 1)cout << "There was 1 vowel.\n";elsecout << "There were " << num << " vowels.\n";//this keeps the prompt console from closingsystem ("pause");// this adds butter to the potatoesreturn 0;}// closing main function// function to identify vowelsbool isVowel(char ch){// make it lower case so we don't have to compare// to both 'a' and 'A', 'e' and 'E', etc.char ch2 = tolower(ch);if (ch2 == 'a' || ch2 == 'e' || ch2 == 'i' || ch2 == 'o' || ch2 == 'u')return true;elsereturn false;}

Engineering
1 answer:
NISA [10]4 years ago
6 0

Answer:

This is the code:

Explanation:

count_vowels.cpp

#include <iostream>

#include <string>

using namespace std;

//functions declared

bool isVowel(char ch);

int main ()

{

  string letters;

  int num = 0;

  int len;

  cout<<"Enter a sequence of characters: ";

  getline(cin, letters);

  len = letters.length();

  for (int i = 0; i < len; i++)

  {

      if (isVowel(letters[i]))

          num++;

  }

  cout << "There are "<<num<<" vowels in this sentence."<<endl;

  //this keeps the prompt console from closing

  system ("pause");

  // this adds butter to the potatoes

  return 0;

}// closing main function

// function to identify vowels

bool isVowel(char ch)

{

// make it lower case so we don't have to compare

// to both 'a' and 'A', 'e' and 'E', etc.

char ch2 = tolower(ch);

return ch2 == 'a' || ch2 == 'e' || ch2 == 'i' || ch2 == 'o' || ch2 == 'u';

}

You might be interested in
Cell phones require powerful batteries in orde to work effectively. Which activity is best described as an engineering endeavor
natta225 [31]
Where are the options?
8 0
3 years ago
Technician A says that crush zones on a vehicle are designed to collapse in a controlled manner. Technician B says that reinforc
Ierofanga [76]

Answer:

only A

Explanation:

3 0
3 years ago
Help I will brainliest
ValentinkaMS [17]

Answer:

hacking?

Explanation:

jsd

3 0
3 years ago
Describe (in narrative) the essential funct tion of a Heat Engine?
Vesna [10]

Answer and Explanation:

The heat engine are used for converting the heat energy into mechanical energy .When heat energy is converted into mechanical energy then this mechanical energy are used to do the useful work. Heat engine working based on the three process that are head addition , expansion and heat rejection.

7 0
3 years ago
A CUSTOMER BRINGS HER CAR INTO THE
In-s [12.5K]

a bc if the bulbs are in a bad conditio. than u know that u dont have to remove it but only repair it.

5 0
3 years ago
Read 2 more answers
Other questions:
  • Vitrification is a process of: a. Chemical reaction bonding of aggregate ceramic powder b. Cementing aggregate ceramic powder wi
    9·1 answer
  • Air is flowing in an insulated duct at a rate of 2 kg/sec. Air enters the duct at 40 oC and 8-kW of heat is added with a electri
    5·1 answer
  • 2. What formula relates work and power?​
    10·1 answer
  • What information is usually gathered during vehicle crash tests?
    10·1 answer
  • A power washer is being used to clean the siding of a house. Water enters at 20 C, 1 atm, with a velocity of 0.2 m/s .A jet of w
    12·1 answer
  • A work element in a manual assembly task consists of the following MTM-1 elements: (1) R16C, (2) G4A, (3) M10B5, (4) RL1, (5) R1
    9·1 answer
  • PLEASE FIX THIS LUA SCRIPT
    12·2 answers
  • The air conditioner in a house or a car has a cooler that brings atmospheric air from 30C to 10C, with both states at 101KPa. If
    12·1 answer
  • What are the horizontal structures beneath a slab that help transfer the load from the slab to the columns?
    14·2 answers
  • Aluminium alloys find use in aircraft industry because of
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!