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
A hydraulic jump is induced in an 80 ft wide channel.The water depths on either side of the jump are 1 ft and 10 ft.Please calcu
krek1111 [17]

Answer:

a) 42.08 ft/sec

b) 3366.33 ft³/sec

c) 0.235

d) 18.225 ft

e) 3.80 ft

Explanation:

Given:

b = 80ft

y1 = 1 ft

y2 = 10ft

a) Let's take the formula:

\frac{y2}{y1} = \frac{1}{5} * \sqrt{1 + 8f^2 - 1}

10*2 = \sqrt{1 + 8f^2 - 1

1 + 8f² = (20+1)²

= 8f² = 440

f² = 55

f = 7.416

For velocity of the faster moving flow, we have :

\frac{V_1}{\sqrt{g*y_1}} = 7.416

V_1 = 7.416 *\sqrt{32.2*1}

V1 = 42.08 ft/sec

b) the flow rate will be calculated as

Q = VA

VA = V1 * b *y1

= 42.08 * 80 * 1

= 3366.66 ft³/sec

c) The Froude number of the sub-critical flow.

V2.A2 = 3366.66

Where A2 = 80ft * 10ft

Solving for V2, we have:

V_2 = \frac{3666.66}{80*10}

= 4.208 ft/sec

Froude number, F2 =

\frac{V_2}{g*y_2} = \frac{4.208}{32.2*10}

F2 = 0.235

d) El = \frac{(y_2 - y_1)^3}{4*y_1*y_2}

El = \frac{(10-1)^3}{4*1*10}

= \frac{9^3}{40}

= 18.225ft

e) for critical depth, we use :

y_c = [\frac{(\frac{3366.66}{80})^2}{32.2}]^1^/^3

= 3.80 ft

7 0
3 years ago
Read 2 more answers
An excavation is at risk for cave-in and water accumulation because of the excess soil that has accumulated. What type of excava
s344n2d4d5 [400]

Answer:

Among the different types of excavation protection system, as a way of preventing accidents against cave-ins, the sloping involves cutting back the trench wall at an angle inclined away from the excavation. Shoring requires installing aluminum hydraulic or other types of supports to prevent soil movement and cave-ins. Shielding protects workers by using trench boxes or other types of supports to prevent soil cave-ins (OSHA). In addition, the regulations do not allow employees to work on excavations where there is an accumulation of water. If this occurs, water on the site must be constantly removed by suitable equipment preventing water from accumulating. The entry of surface water into the excavations must also be prevented by means of diversion ditches, dam, or other suitable means.  

Explanation:

3 0
3 years ago
Select the correct answer. Which existing technology did engineers use to enhance the speed of propeller-driven airplanes
Musya8 [376]

metallurgy:

Explanation:

7 0
3 years ago
Tech A says that water soaked brake shoes can be a cause of brake fade. Tech B says that disc brakes dissipate heat faster than
alina1380 [7]

Explanation:

perturbateur ( le temps, le lieu, les personnages[description], la victime, l'enqueteur )

les peripeties

le denouement

5 0
2 years ago
What color is an orange? its for my 8th grade
Ksenya-84 [330]

Answer:

hmmmm i think orange I may be wrong....

Explanation:

5 0
3 years ago
Other questions:
  • Indicate on a tensile curve such quantities as yield stress, Young's modulus, UTS, toughness, point of necking, point of fractur
    7·1 answer
  • 21.13 The index of refraction of corundum (Al2O3) is anisotropic. Suppose that visible light is passing from one grain to anothe
    5·1 answer
  • Write a program that uses the function isPalindrome given below. Test your program on the following strings: madam, abba, 22, 67
    13·1 answer
  • Consider a sphere made of stainless steel with diameter of 25 cm. It is heated to temperature of 300°C for some chemical tests.
    12·1 answer
  • In contouring, it is necessary to measure position and not velocity for feedback.
    9·1 answer
  • 2.
    7·1 answer
  • Would you ever date a transgender person??
    8·2 answers
  • What is the gear ratio of the given train
    6·1 answer
  • Why the power factor is Low in no load test in induction motor ?​
    13·1 answer
  • On the pavement indicate that the adjacent lane is traveling in the same direction and passing is permitted
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!