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
Architecture reflects multidisciplinary
vovangra [49]

Answer:

The architectural profession is multidisciplinary. ... Some of the disciplines which intervene in the design of a building are: architectural composition, structural engineering, architectural technology and energy engineering. Depending on the strategy of designing, one or more disciplines can have priority over others..

Explanation:

Hope it helps you..

Just correct me if I'm Wrong..

But, your welcome in advance..

(╥﹏╥)(ㆁωㆁ)

6 0
3 years ago
Define the Problem
gtnhenbr [62]

Answer:

rbrnrifnfnrfbdjrbfbfjrn

4 0
3 years ago
You are considering purchasing a compact washing machine, and you have the following information: The Energy Guide claims an est
RSB [31]

Answer: $15.34

Explanation: see image below

8 0
3 years ago
A gas metal arc welder is also known as a _____ welder.<br> A) TIGB) GTAWC) GMAWD) Resistance spot
nignag [31]

Answer:

GMAW

Explanation:

It's literally the initials of that type of welding

7 0
3 years ago
A plane wall of thickness 0.1 m and thermal conductivity 25 W/m·K having uniform volumetric heat generation of 0.3 MW/m3 is insu
Contact [7]

Answer:

T = 167 ° C

Explanation:

To solve the question we have the following known variables

Type of surface = plane wall ,

Thermal conductivity k = 25.0 W/m·K,  

Thickness L = 0.1 m,

Heat generation rate q' = 0.300 MW/m³,

Heat transfer coefficient hc = 400 W/m² ·K,

Ambient temperature T∞ = 32.0 °C

We are to determine the maximum temperature in the wall

Assumptions for the calculation are as follows

  • Negligible heat loss through the insulation
  • Steady state system
  • One dimensional conduction across the wall

Therefore by the one dimensional conduction equation we have

k\frac{d^{2}T }{dx^{2} } +q'_{G} = \rho c\frac{dT}{dt}

During steady state

\frac{dT}{dt} = 0 which gives k\frac{d^{2}T }{dx^{2} } +q'_{G} = 0

From which we have \frac{d^{2}T }{dx^{2} }  = -\frac{q'_{G}}{k}

Considering the boundary condition at x =0 where there is no heat loss

 \frac{dT}{dt} = 0 also at the other end of the plane wall we have

-k\frac{dT }{dx } = hc (T - T∞) at point x = L

Integrating the equation we have

\frac{dT }{dx }  = \frac{q'_{G}}{k} x+ C_{1} from which C₁ is evaluated from the first boundary condition thus

0 = \frac{q'_{G}}{k} (0)+ C_{1}  from which C₁ = 0

From the second integration we have

T  = -\frac{q'_{G}}{2k} x^{2} + C_{2}

From which we can solve for C₂ by substituting the T and the first derivative into the second boundary condition s follows

-k\frac{q'_{G}L}{k} = h_{c}( -\frac{q'_{G}L^{2} }{k}  + C_{2}-T∞) → C₂ = q'_{G}L(\frac{1}{h_{c} }+ \frac{L}{2k} } )+T∞

T(x) = \frac{q'_{G}}{2k} x^{2} + q'_{G}L(\frac{1}{h_{c} }+ \frac{L}{2k} } )+T∞ and T(x) = T∞ + \frac{q'_{G}}{2k} (L^{2}+(\frac{2kL}{h_{c} }} )-x^{2} )

∴ Tmax → when x = 0 = T∞ + \frac{q'_{G}}{2k} (L^{2}+(\frac{2kL}{h_{c} }} ))

Substituting the values we get

T = 167 ° C

4 0
3 years ago
Other questions:
  • Consider 1.0 kg of austenite containing 1.15 wt% C, cooled to below 727C (1341F). (a) What is the proeutectoid phase? (b) How
    14·1 answer
  • Polymer ropes and lines for use on water are often designed to float, to aid in their retrieval and to avoid applying a downward
    6·1 answer
  • A stone-filled pit used for waste disposal is commonly referred to as a
    15·1 answer
  • A well penetrates an unconfined aquifer. Prior to pumping, the water level (head) is 25 meters. After a long period of pumping a
    14·1 answer
  • A device that helps increase field worker productivity by providing reliable location and time
    13·1 answer
  • A certain metal has a resistivity of 1.68 × 10-8 Ω ∙ m. You have a long spool of wire made from this metal. If this wire has a d
    14·1 answer
  • A Carnot engine is operated between two heat reservoirs at temperatures of 520 K and 300 K. It receives heat from the 520 K rese
    8·1 answer
  • Technician A says that a lack of lubrication on the back of the disc brake pads can cause brake noise. Technician B says that pa
    8·1 answer
  • The ruler game, HELPPPP PLS
    11·2 answers
  • Technician A says that fuel filler caps with pressure and vacuum vents are used with EVAP system fuel tanks. Technician B says t
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!