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
Please define the coefficient of thermal expansion?
Vikki [24]

Answer:

The coefficient of thermal expansion tells us how much a material can expand due to heat.

Explanation:

Thermal expansion occurs when a material is subjected to heat and changes it's shape, area and volume as a result of that heat. How much that material changes is dependent on it's coefficient of thermal expansion.

Different materials have different coefficients of thermal expansion (i.e. It is a material property and differs from one material to the next). It is important to understand how materials behave when heated, especially for engineering applications when a change in dimension might pose a problem or risk (eg. building large structures).

7 0
3 years ago
List and briefly describe two modern's materials needs
Angelina_Jolie [31]

Answer:

Modern and smart materials for making the products are improved by developing new materials and find new uses for the existing. As, modern industrialization society is increased demand and quality of the product.

Two modern's materials are:

Carbon Fiber: As, carbon fiber is a strong material and it is light in weight. Designers used it because it is five times strong as steel and two times as stiff. Carbon fiber is basically made out of very thin strands of carbon.

Fiber Optics: It is a new technology as, it is used as transparent solid to transmitted light signals.

4 0
4 years ago
(a) What is the distinction between hypoeutectoid and hypereutectoid steels? (b) In a hypoeutectoid steel, both eutectoid and pr
Gnoma [55]

Answer:

See explanation below

Explanation:

Hypo-eutectoid steel has less than 0,8% of C in its composition.

It is composed by pearlite and α-ferrite, whereas Hyper-eutectoid steel has between 0.8% and 2% of C, composed by pearlite and cementite.

Ferrite has a higher tensile strength than cementite but cementite is harder.

Considering that hypoeutectoid steel contains ferrite at grain boundaries and pearlite inside grains whereas hypereutectoid steel contains a higher amount of cementite, the following properties are obtainable:

Hypo-eutectoid steel has higher yield strength than Hyper-eutectoid steel

Hypo-eutectoid steel is more ductile than Hyper-eutectoid steel

Hyper-eutectoid steel is harder than Hyper-eutectoid steel

Hypo-eutectoid steel has more tensile strength than Hyper-eutectoid steel.

When making a knife or axe blade, I would choose Hyper-eutectoid steel alloy because

1. It is harder

2. It has low cost

3. It is lighter

When making a die to press powders or stamp a softer metals, I will choose hypo-eutectoid steel alloy because

1. It is ductile

2. It has high tensile strength

3. It is durable

7 0
3 years ago
Read 2 more answers
Many jacks use hydraulic power. True or False
34kurt

Answer:true

Explanation:

7 0
3 years ago
(Almost) FREE POINTS!!!!! Hey there, Im writting a research paper, and I want to know if you think NASA is a waste of money or n
tatuchka [14]

Answer:

No I don't think NASA is a waste of time. I don't think its a waste of time because NASA is exploring what is beyond Earth and its important to know about Space.

Explanation:

3 0
3 years ago
Read 2 more answers
Other questions:
  • To water his lawn, a homeowner uses two hoses. One connects to the faucet, the other to the end of the first hose to make the ho
    14·1 answer
  • Supercharging is the process of (a) Supplying the intake of an engine with air at a density greater than the density of the surr
    7·1 answer
  • What is the heat flux (W/m2) to an object when subjected to convection heat transfer environment given: 24 °C = the surface temp
    10·1 answer
  • For ceramic-matrix composites, high interfacial strength is desirable. ( True , False )
    8·1 answer
  • 1. How does manufacturing help strengthen<br> the economy?
    15·1 answer
  • 9.21 A household oven door of 0.5-m height and 0.7-m width reaches an average surface temperature of 32℃ during operation. Estim
    8·1 answer
  • The radial component of acceleration of a particle moving in a circular path is always:________ a. negative. b. directed towards
    9·1 answer
  • What type of foundation do engineers use for a small and light building and when the load of the building is borne by columns? A
    8·1 answer
  • A machine raises 20kg of water through a height of 50m in 10secs. What is the power of the machine.​
    5·1 answer
  • A seamless pipe carries 2400m³ of steam per hour at a pressure of 1.4N/mm².The velocity of flow is 30m/s.assuming the tensile st
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!