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
Bess [88]
3 years ago
13

Write a function that counts and returns the number of vowels in the input, up to the next newline or until the input is done, w

hichever comes first. Your function should have the following prototype:
int count_vowels();
Computers and Technology
1 answer:
Valentin [98]3 years ago
3 0

Answer:

// here is code in C++.

#include <bits/stdc++.h>

using namespace std;

// function that return the number of vowels in the input string

int count_vowels()

{

// variable

   string str;

   int v_count=0;

   cout<<"enter the string:";

   // read the string

   cin>>str;

   // fuind the length

   int len=str.length();

   // check for vowel

   for(int x=0;x<len;x++)

   {

       char ch=str[x];

       if(ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u'||ch=='A'||ch=='E'||ch=='I'||ch=='O'|ch=='U')

       {

           v_count++;

       }

   }

   // return the count

   return v_count;

}

// driver function

int main() {

// call the function and print the result

cout<<"number of vowels in string is : "<< count_vowels()<<endl;

return 0;

}

Explanation:

In the function count_vowels(), read a sting and then find its length.Then check each character of the string is vowel or not.If it is vowel then Increment the v_count. After the loop return the count to main function and print it.

Output:

enter the string: welcometoprogramming

number of vowels in string is : 7

You might be interested in
You often travel away from the office. While traveling, you would like to use a modem on your laptop computer to connect directl
34kurt

Answer:

The answer is "Remote access "

Explanation:

The capacity to access another computer or network that you do not have. Remote computer access provides an employee with remote access to the desktop and file. This assists an employee, for example, who works at home efficiently.

Remote users access documents or other resources on any network-connected device or server, enhancing organizational efficiency and increase there are to cooperate more interact with peers nation.

6 0
3 years ago
Consider the code fragment below (with nested loops). int sum = 0;for (int i = 1; i &lt; 5; i++) for (int j = 1; j &lt;= i; j++)
sammy [17]

Answer:

Option d is the correct answer for the above question.

Explanation:

  • The first loop of the program has a second loop and then the statement. In this scenario, the second loop executes for the value of the first loop and the statement executes for the value of the second loop.
  • The first loop executes 4 times, Then the second loop or inner loop executes n times for the n iteration of the first loop, for example, 1 time for the first iteration of the first loop, 2 times for the second iteration of the first loop and so on.
  • Then the inner loop executes (1+2+3+4) iteration which gives the result 10 iterations.
  • The sum initial value is 0 and the "sum++", increase the value of the sum by 1.
  • So the value of the sum becomes 10 after completing 10 iterations of the inner for loop.
  • Hence the 10 will be the output. So the Option d is the correct answer while the other is not.
3 0
3 years ago
Rosa is a high school freshman with no savings. She wants to buy a new smartphone in a few months for $300. Which account type b
Iteru [2.4K]
Simple savings account
6 0
3 years ago
Read 2 more answers
2. What is the name for an action performed by the VR Robot?
pychu [463]
Parameter is the answer you wanted
4 0
3 years ago
Read 2 more answers
ou have a company network that is connected to the internet. You want all users to have internet access, but you need to protect
Rus_ich [418]

Server and network is 2 different things, just put the server on a different network.  ;) duh

Explanation:

4 0
3 years ago
Other questions:
  • You have just performed a cpm analysis and have found that more than one path through the project network has zero slack values.
    13·1 answer
  • Credit card numbers follow a standard system. For example, Visa, MasterCard, and Discpver Card all have 16 digits, and the first
    11·1 answer
  • What is the most flexible way to modify a report?
    7·1 answer
  • Need help answering this
    7·1 answer
  • You work as the IT administrator for a small corporate network. To accommodate specific network communication needs for an upcom
    9·1 answer
  • Given the following MIPS Code Fragment:
    14·1 answer
  • Psychographics may also be called A. personality analytics. B. social group dynamics. C. lifestyle analysis. D. opinion insight.
    6·1 answer
  • To speed up the display of graphics, a(n) ________ is integrated into some video cards. select one:
    12·1 answer
  • What does an effect allow you to do in<br> EarSketch?
    15·1 answer
  • What are the sectors of the buisness enviornment
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!