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
Which of the following characteristics would not give animals an advantage in the ocean?
Taya2010 [7]
I believes it’s long body hair
3 0
2 years ago
A piston/cylinder contains 1.5 kg of water at 200 kPa, 150°C. It is now heated by a process in which pressure is linearly relate
Fofino [41]

Answer:

final volume V2 = 0.71136 m³

work done in process W = -291.24 kJ

heat transfer Q = 164 kJ

Explanation:

given data

mass = 1.5 kg

pressure p1 = 200 kPa

temperature t1 = 150°C

final pressure p2 = 600 kPa

final temperature t2 = 350°C

solution

we will use here superheated water table that is

for pressure 200 kPa and 150°C temperature

v1 = 0.95964 m³/kg

u1 = 2576.87 kJ/kg

and

for pressure 600 kPa and 350°C temperature

v2 = 0.47424 m³/kg

u2 = 2881.12 kJ/kg

so v1 is express as

V1 = v1 × m    ............................1

V1 = 0.95964 × 1.5

V1 = 1.43946 m³

and

V2 = v2 × m    ............................2

V2 = 0.47424 × 1.5

final volume V2 = 0.71136 m³

and

W = P(avg) × dV      .............................3

P(avg) = \frac{p1+p2}{2}    = \frac{200+600}{2} = 400 × 10³

put here value

W = 400 × 10³ × (0.71136 - 1.43946 )

work done in process W = -291.24 kJ

and

heat transfer is

Q = m × (u2 - u1)  + W       .............................4

Q = 1.5 × (2881.12 - 2576.87)  + 292.24

heat transfer Q = 164 kJ

7 0
2 years ago
-Electronic control modules can easily evaluate the voltage and current levels of circuits to which they are connected and deter
erma4kov [3.2K]

Answer:

multiplexing

Explanation:

3 0
2 years ago
What was the purpose of the vasa ship
goldfiish [28.3K]
The main purpose was for power. The vessel has come to symbolize Sweden's Great Power Period, when the nation became a major European power and controlled much of the Baltic.
8 0
3 years ago
A 400-m^3 storage tank is being constructed to hold LNG, liquefied natural gas, which may be assumed to be essentially pure meth
GuDViN [60]

Answer:

mass of LNG: 129501.3388 kg

quality: 0.005048662

Explanation:

Volume occupied by liquid:

400 m^3*0.9 = 360 m^3

Volume occupied by vapor

400 m^3*0.1 = 40 m^3  

A figured with thermodynamic properties of saturated methane is attached. Notice that a liquid-gas mixture is present

For liquid phase specific volume (vf) at 150 K is 0.002794 m^3/kg and for vapor phase specific volume (vg) is 0.06118 m^3/kg

From specific volume definition:

vf = liquid volume/liquid mass

liquid mass = liquid volume/vf

liquid mass = 360 m^3/0.002794 m^3/kg

liquid mass = 128847.5304 kg

vg = vapor volume/vapor mass

vapor mass = liquid volume/vg

vapor mass = 40 m^3/0.06118 m^3/kg

vapor mass = 653.8084341 kg

total mass = 128847.5304 kg + 653.8084341 kg = 129501.3388 kg

Quality is defined as the ratio between vapor mass and total mass

quality =  653.8084341 kg/129501.3388 kg = 0.005048662

4 0
3 years ago
Other questions:
  • The lab technician you recently hired tells you the following: Boss, an undisturbed sample of saturated clayey soil was brought
    6·1 answer
  • Cng containers need to be inspected
    7·1 answer
  • Oil with a specific gravity of 0.72 is used as the indicating fluid in a manometer. If the differential pressure across the ends
    6·1 answer
  • Python lists are commonly used to store data types. Lists are a collection of information typically called a container. Think of
    5·1 answer
  • A piston–cylinder device contains 0.78 kg of nitrogen gas at 140 kPa and 37°C. The gas is now compressed slowly in a polytropic
    11·1 answer
  • 12. A structural component is fabricated from an alloy that has a plane strain fracture toughness of It has been determined that
    11·1 answer
  • PLEASE HELP ASAP!!! Thanks
    11·1 answer
  • Which is an alloy made up of iron and carbon and has high compressive and tensile strength?
    6·1 answer
  • A student used a 500-ml graduated cylinder to measure the volume of water in a 1-cup measure. three trials of the measurement ga
    10·1 answer
  • Airbags may deploy in the<br> of the passenger or<br> driver, or from the<br> of the vehicle.
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!