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
What are the factors of production in business? Land, labor, and capital land, capital, and interest land, labor, and customer b
kozerog [31]

Answer:

  • <em><u> Land, labor, and capital </u></em>

Explanation:

The <em>factors of production </em>are the resources that are used to produce goods and services.

By definition resources are scarce.

<em>Land</em> includes everything that comes from the land, that can be used as raw material to produce other materials; for instance, water, minerals, wood.

<em>Labor</em>  is the work done by anybody, not just at a factory but at any enterpise that produce a good or a service. For instance, the work done by a person in a bank or a restaurant.

<em>Capital</em> is the facilites (buildings), machinery, equipments, tools that the persons use to produce goods or services. For instance, a computer, a chemical reactor, or a pencil.

Nowadays, also entrepreneurship is included as a <em>factor of production</em>, since it is the innovative skill of the entrepeneurs to combine land, labor and capital what permit the production of good and services.

6 0
3 years ago
Read 2 more answers
Select the correct answer.
cricket20 [7]

Answer:

A.

The power generated by a wind farm is not constant because of irregular wind patterns.

5 0
3 years ago
............ ..........<br>​
sukhopar [10]

Answer:

...................

Explanation:

6 0
2 years ago
What is the best engineering job to do? Why?
allochka39001 [22]

Answer:

Any engineering job would be good YOU should be the one choosing which job.

Explanation:

Engineering is a great outlet for the imagination, and the perfect field for independent thinkers.

7 0
2 years ago
Read 2 more answers
As a general rule of thumb, in-line engines are easier to work on than the other cylinder arrangements.
siniylev [52]

Answer:

The general rule of thumb is that the SMALLER a substance's atoms and the STRONGER the bonds, the harder the substance. Two of the strongest forms of chemical bonds are the ionic and covalent bonds.

Explanation:

5 0
2 years ago
Other questions:
  • Steam undergoes an isentropic compression in an insulated piston–cylinder assembly from an initial state where T1 5 1208C, p1 5
    15·1 answer
  • What’s the purpose of current tracks
    6·1 answer
  • The drag force, Fd, imposed by the surrounding air on a
    13·1 answer
  • Tanya Pierce, President and owner of Florida Now Real Estate is seeking your assistance in designing a database for her business
    9·1 answer
  • A 860 kΩ resistor has 34 μA of current. What is the supply voltage for this electric circuit?
    13·2 answers
  • Sam, a carpenter, is asked to identify the abilities he has that are important to his work. What are the top abilities he might
    9·2 answers
  • Which type of engineers were the designers of the Great Pyramids of Egypt and the Great Wall of China?
    9·2 answers
  • What is the moment that the wrench puts on the bolt?
    13·1 answer
  • All people<br><br><br>id 5603642259 pd 123456<br>on z o o m​
    15·1 answer
  • What were some of the challenges to safety resulting from such radical airframe designs as highly swept wings, high wing loading
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!