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
Alexxandr [17]
3 years ago
5

Write a program in C++ that prompts the user to input a sequence of characters and outputs the number of vowels: Use the functio

n we wrote in class that inputs a character and returns true (or 1) if the character is a vowel otherwise it returns a falsehere is what I have so far:
Computers and Technology
1 answer:
almond37 [142]3 years ago
8 0

Answer:

The program to this question can be given as:

Program:

#include <iostream>  //define header file

#include <string>

 //define header file

using namespace std;  

//namespace std;

bool search_Vowel( char cha )  //function definition.

{

return(cha=='a'||cha=='e'||cha=='i'||cha=='o'||cha=='u');//return value.

}

int main()  //main method.

{

   int count=0,i; //define variable.  

   string value;  

   value = "Enter a string value :";  

   cout<<value<< endl;//print value.

   getline(cin,value); //use getline function.

   for (i = 0;i<value.size(); i++ ) //loop

   {

       if (search_Vowel(value[i])) //conditional statement.

       {

           count++; //increase count.

       }

   }

   cout << "In the above string value, there are "<< count <<" vowels." <<endl; //print value.

   return 0;

}

Output:

Enter a string value :

hello..! my name is dev.

In the above string value, there are 6 vowels.

Explanation:

The above program description can be given as below:

  • In the C++ program, firstly we define the header file. After defining the header file we define a function that is "search_Vowel()". In this function, we pass a char variable that is "cha". The data type of this function is string because it returns a string value.  
  • In this function use OR logical operator that checks if any value in the condition is true so, It will return a value.
  • Then we define the main() function in this function we define a variable that is "i, count and value". In which variable i use in the loop and count variable used for count vowels. The value variable is used for taking input from the user. For input, we use the getline() function.  
  • Then we define the for loop in this loop we use the conditional statement in if block we call the search_Vowel in which we pass the value variable.
  • In the above program, the count variable prints the count of vowels.
You might be interested in
Fill in the blanks Pasaline could ----- and ------- very easily.​
Artemon [7]

Answer:

<h2>Hot you too friend's house and be safe and have a great time to take care of the following is not a characteristic it was a circle whose equation o</h2>
6 0
3 years ago
Without using any additional variables, and without changing the values of ndays or the elements of the parkingTickets array, wr
dusya [7]

Answer:

Explanation:

mostTickets=0;

for (k=0; k< ndays; k++){

if (parkingTickets[k]>mostTickets) mostTickets=parkingTickets[k];

}

7 0
3 years ago
Who has a brainpop acct. can i pls use it !
RSB [31]

Answer:

Союз нерушимый республик свободных

Сплотила навеки Великая Русь.

Да здравствует созданный волей народов

Единый, могучий Советский Союз!

Славься, Отечество наше свободное,

Дружбы, народов надежный оплот!

Знамя советское, знамя народное

Пусть от победы, к победе ведет!

Сквозь грозы сияло нам солнце свободы,

И Ленин великий нам путь озарил.

Нас вырастил Сталин - на верность народу

На труд и на подвиги нас вдохновил.

Славься, Отечество чаше свободное,

Счастья народов надежный оплот!

Знамя советское, знамя народное

Пусть от победы к победе ведет!

Skvoz grozy siialo nam solntse svobody,

I Lenin velikij nam put ozaril.

Nas vyrastil Stalin - na vernost narodu

Na trud i na podvigi nas vdokhnovil.

Slavsia, Otechestvo chashe svobodnoe,

Schastia narodov nadezhnyj oplot!

Znamia sovetskoe, znamia narodnoe

Pust ot pobedy k pobede vedet!

Мы армию нашу растили в сраженьях,

Захватчиков подлых с дороги сметем!

Мы в битвах решаем судьбу поколений,

Мы к славе Отчизну свою поведем!

Славься, Отечество наше свободное,

Славы народов надежный оплот!

Знамя советское, знамя народное

Пусть от победы к победе ведет!Explanation:

8 0
3 years ago
What effect does using quotas in file server resource manager have?
andrezito [222]
It limits the number of gigabytes allocated to a volume or folder
5 0
3 years ago
Which best describes how the government sanctions technological monopolies?
stira [4]
By simply prohibiting others from entering the markets is the best example how the government sanctions technological monopolies.
This is to avoid  competitors and give the people no choice but to buy thier products
4 0
3 years ago
Read 2 more answers
Other questions:
  • WILL GIVE BRAINLIEST PLEASE HELP / urgent
    9·1 answer
  • 3 uses for auto formatting
    9·1 answer
  • The possible states of a process are:
    6·2 answers
  • Need done ASAP
    15·1 answer
  • You are most likely to use<br> images for photos or digital paintings.
    6·1 answer
  • If your computer won't connect to the internet, which of these is most likely to be the problem?
    8·1 answer
  • When light does not pass through or bounce off an object, it is said to be
    13·2 answers
  • I'd: 9872093250, password: qqqqq, join the meeting​
    11·1 answer
  • What is the term of illegal copy of software?​
    12·1 answer
  • There is a group of 10 people who are ordering pizza. If each person gets 2 slices and each pizza has 5 slices, how many pizzas
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!