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]
3 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]3 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
Two well-known NP-complete problems are 3-SAT and TSP, the traveling salesman problem. The 2-SAT problem is a SAT variant in whi
Hitman42 [59]

3-SAT ≤p TSP

If P ¹ NP, then no NP-complete problem can be solved in polynomial time.

both the statements are true.

<u>Explanation:</u>

  • 3-SAT ≤p TSP due to any  complete problem of NP to other problem by exits of reductions.
  • If P ¹ NP, then 3-SAT ≤p 2-SAT are the polynomial time algorithm are not for 3-SAT. In P, 2-SAT is found, 3- SAT polynomial time algorithm implies the exit of reductions. 3 SAT does not have polynomial time algorithm when P≠NP.
  • If P ¹ NP, then no NP-complete problem can be solved in polynomial time. because for the NP complete problem individually gets the polynomial time algorithm for the others. It may be in P for all the problems, the implication of latter is P≠NP.
7 0
3 years ago
Describe how you would control employee exposure to excessive noise in a mining environment
Alexandra [31]

Answer:

1. Buy Quiet – select and purchase low-noise tools and machinery

2. Maintain tools and equipment routinely (such 3. as lubricate gears)

3. Reduce vibration where possible

4. Isolate the noise source in an insulated room or enclosure

5. Place a barrier between the noise source and the employee

6. Isolate the employee from the source in a room or booth (such as sound wall or window

Explanation:

Hope my answer will help u.

7 0
2 years ago
Which of the following allows team members to visualize a design model from a variety of perspectives?
julsineya [31]

Answer: from what i know im pretty sure its isometrics or sketches im certain its sketches but not 100%

Explanation: A sketch is a rapidly executed freehand drawing that is not usually intended as a finished work. A sketch may serve a number of purposes: it might record something that the artist sees, it might record

8 0
3 years ago
Read 2 more answers
Please help me fast, I don’t have time
Anna71 [15]

Answer: precision

Explanation: Because accuracy is where you keep on getting it right but precision is where you get closer and closer

5 0
3 years ago
A series of concrete pillars have been built on the border between Kuwait and Iraq. They are there to __________ the border.
Gala2k [10]

A series of concrete pillars have been built on the border between Kuwait and Iraq. They are there to demarcate the border.

<h3>What is a border?</h3>

A border is a geographical boundary that separate<em> countries, states, provinces, counties, cities, and towns.</em>

A series of concrete pillars have been built on the border between Kuwait and Iraq. They are there to demarcate the border.

Find out more on border at: brainly.com/question/811755

5 0
2 years ago
Other questions:
  • List irreversibilities
    11·1 answer
  • Which of the following describes fibers? a)- Single crystals with extremely large length-to-diameter ratios. b)- Polycrystalline
    10·1 answer
  • There are 30 students in a class. Choose the statement that best explains why at least two students have last names that begin w
    12·1 answer
  • What is compression ratio of an Otto cycle? How does it affect the thermal efficiency of the cycle?
    14·1 answer
  • Calculate the diffusion current density for the following carrier distributions. For electrons, use Dn = 35 cm2/s and for holes,
    6·1 answer
  • 2.18 The net potential energy between two adjacent ions, EN, may be represented by the following equation: (1) Calculate the bon
    5·1 answer
  • Water evaporating from a pond does so as if it were diffusing across an air film 0.15 cm thick. The diffusion coefficient of wat
    8·1 answer
  • A jet impinges directly on to a plate that is oriented normal to the axis of the jet. The mass flow rate of the jet is 50 kg/min
    8·1 answer
  • The line touching the circle at a point ....................... is known as ........................... .
    12·1 answer
  • . H<br> Kijwhayhwbbwyhwbwbwgwwgbwbwhwh
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!