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
dalvyx [7]
2 years ago
7

Write a function float Average(int, int) that finds the mean, and then write a main program that inputs two numbers from the use

r repeatedly until the user enter “0”. You need to call the function and display the mean of two numbers in the main. C++ language only.
Computers and Technology
1 answer:
meriva2 years ago
5 0

The program illustrates the use of functions.

Functions are used to group related code segments that act as one, when called.

The program in C++ where comments are used to explain each line is as follows:

#include <iostream>

using namespace std;

//This defines the Average function

float Average(int num1, int num2){

   //This returns the average of the numbers

   return (num1+num2)/2.0;

}

//The main method begins here

int main(){

   //This declares the numbers as integer

   int num1, num2;

   //This gets input for both numbers

   cin>>num1; cin>>num2;

   //This is repeated until the user enters 0

   while(num1!=0 || num2 !=0){

       //This calls the average function, and prints the average

       cout<<Average(num1,num2)<<'\n';

       //This gets input for both numbers, again

       cin>>num1; cin>>num2;

   }

   return 0;

}

Read more about similar programs at:

brainly.com/question/17378192

You might be interested in
Assume that a variable variable, number Of Sides has been initialized. Write a statement that assigns the value True to the vari
inna [77]

Answer:

public class ANot {

   public static void main(String[] args) {

   

       int numberOfSides = 20;

       boolean isQuadrilateral;

       if(numberOfSides==4){

           isQuadrilateral = true;

           System.out.println("The triangle is quadrilateral");

       }

       else{

           isQuadrilateral=false;

           System.out.println("The triangle is not quadrilateral");

       }          

}

}

Explanation:

  1. Create and Initilize the int  variable numberOfSides (You can also receive this from a user using the scanner class for example).
  2. create a boolean variable isQuadrilateral
  3. Use if and else statement to check if numberOfSides ==4 and assign true to isQuadrilateral else assign false
7 0
3 years ago
Which type of programmer designs programs for applications executed on the internet?
lisabon 2012 [21]
Wait. What? What does that even mean?
8 0
3 years ago
Learning Management Systems (LMS) allow students to interact with each other, but NOT their teachers.
VMariaS [17]

Answer:

what do you mean friend not for teacher

8 0
3 years ago
Read 2 more answers
If you wanted a computer to store a variable with the content of “110 Maple Street,” which data type would be most appropriate?
hichkok12 [17]

Answer:

string

Explanation:

string holds words while boolean only returns true or false and both binary and float  hold numbers

8 0
3 years ago
Read 2 more answers
A computer emergency response team is called at midnight to investigate a case in which a mail server was restarted. After an in
ANEK [815]

<u>Answer</u>:   B. Identify the source of the active connection

<em>Any problem can be fixed only finding of the source of it. We can fix a problem in ‘n’ number of ways but it might again come back if source of it is not identified.</em>

<u>Explanation:</u>

Identify the source of the active connection is the NEXT step the team should take. It is very similar to our human body.

If the infection is coming in the body again and again and gets fixed in the treatment, the reason for come - back will be identified so that it does not <em>lead to unnecessary treatment. </em>

In a similar way, if source are identified then the problem of come-back can be avoided. <em>So option B would be the right choice.</em>

4 0
3 years ago
Other questions:
  • Using the merge method of the Map interface, which statement correctly updates the salesTotalByDept map of type Map to update th
    7·1 answer
  • Write a function that takes an array of integers and its size as parameters and prints the two largest values in the array. In t
    5·1 answer
  • Consider the class Money declared below. Write the member functions declared below and the definition of the overloaded +. Modif
    13·1 answer
  • What information medium is used to access information from the Internet in the form of HTML pages?
    12·1 answer
  • Why did Hunter gatherers moved into the<br>America's?​
    8·1 answer
  • What does the revolver do computer science​
    9·1 answer
  • Vanessa is a set designer. She is working on a period film set in Egypt. She has selected several items for a scene in a palace.
    7·2 answers
  • JAVA NEED HELP ASAP
    7·1 answer
  • 75 pts. Conduct online research about 10 of the most famous and dangerous computer viruses that threatened computer networks aro
    13·1 answer
  • Random.choice will choose a number between 1 and 100. True False​
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!