Write a function float Average(int, int) that finds the mean, and then write a main program that inputs two numbers from the user 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.

Answers

Answer 1

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:

https://brainly.com/question/17378192


Related Questions

One of the best ways to code effective programs is to write so-called _______ programs, using the sequential, selection, or repetition logic structures.

Answers

One of the best ways to code effective programs is to write so-called structured programs, using the sequential, selection, or repetition logic structures.

Structured programs are program types that aim to improve the clarity of program codes to make them readable and reusable.

Structural codes such as the if/then/else for selection and while/for repetition are used to achieve these goals.

So, structured programs are used to write programs that follow the sequential, selection, and repetition logic structures.

Learn more about structured programs here:

https://brainly.com/question/25770844

To gain access to the functions and variables of a library module, use a(n) _________ statement. A. import B. export C. global D. library

Answers

Answer: import

Explanation:

What does the Finder do?


locates files

organizes computer folders and files

opens applications

empties the Trash

deletes files

turns off the computer

Answers

locate files , open applications

In cell a10 enter a formula using or to display true if net profit before tax in 2019 (cell b5) are greater than 750000(seven hundred, fifty thousand) or net profit before tax in 2020 (cell c5) are greater than 750000 (seven hundred, fifty thousand). use cell references where appropriate and enter the arguments exactly as described in this question.

Answers

The OR Excel function is a function that is used to test several conditions in one statement.

The Excel formula to display true based on the conditions in cell A10 is =OR(B5>750000,C5>750000)

From the question, we have:

Cell B5 represents the net profit before tax in 2019Cell C5 represents the net profit before tax in 2020

The syntax of the OR logical function is: =OR([conditions])

So, the Excel formula to display true based on the conditions in cell A10 is =OR(B5>750000,C5>750000)

Read more about Excel formulas at:

https://brainly.com/question/14820723

What number is represented as a binary code of 101110

Answers

Answer:

46 i think

Explanation:

sorry if thats wrong

46

46 in binary is 101110

write an algorithm to print circumference of a circle​

Answers

Answer:

1 Start

2 Read the value of radius r of Circle

3. Give Pi = 3.14

4 Calculate area of Circle = Pi x r x r

5. Calculate Circumference of circle

( You can use either C= 2 X Pi X r Or Area (A) = Pi X r X r Circumference (C) = 2 X Pi X r A/r = Pi X r A/r = C/2 So C = 2 x ( A/r ) 5. Print area and Circumference

6. End.

According to popular science Web sites, the scientific process of digital forensics normally starts with a(n) ________.

Answers

Answer:

a hypothesis that forms into a question.

Explanation:

A _____ is a network operating on a radio frequency (RF), consisting of radio cells, each served by a fixed transmitter.

Answers

Answer:

A cellular network is a network...

PLEASE I NEED HELP ASAP PLEASE PLEASE!!!

For a list of numbers entered by the user and terminated by 0, find the sum of the positive numbers and the sum of the negative numbers. C++ language only.

Answers

Answer:

Following are the program in the Python Programming Language

#set variables to 0

positive_sum=0  

negative_sum=0  

#print message  

print("Enter 0 to terminate")  

#set the while loop  

while(True):  

#get input from the user  

num=float(input("Enter positive or negative numbers: "))  

#set if statement to check condition  

if(num==0):  

  break  

elif(num>0):  

  positive_sum+=num  

else:  

  negative_sum+=num  

#print output with message  

print()  

print("sum of positive numbers: ", positive_sum)  

print("sum of negative numbers: ", negative_sum)  

Output:  

Enter 0 to terminate  

Enter positive or negative numbers: 1  

Enter positive or negative numbers: 3  

Enter positive or negative numbers: 5  

Enter positive or negative numbers: -7  

Enter positive or negative numbers: -2Enter positive or negative numbers: 0  

sum of positive numbers:  9.0  

sum of negative numbers:  -9.0

Explanation:

Here, we set two integer data type variables "positive_sum", "negative_sum" and initialize to 0.

Then, we set the while infinite loop inside the loop.

Set a variable "num" and get input from the user in it.

Set the if conditional statement and check condition the variable "num" is equal to 0 then, loop will terminate.

Set the elif statement and check condition the variable "num" is greater than 0 then, add that input and store in the variable "positive_sum"

Otherwise, add that input and store in the variable "negative_sum".

Finally, we print the output with the message.

Additional Activities Direction: List down all the safety and work procedures in using newly purchased gadget. Write your answers on a separate sheet of paper.​

Answers

Answer: Keep your phone away from your body and head. Turn off your phone or turn on airplane mode at bedtime. Use headsets, preferably air tube, and speaker phone when possible. Don't carry your cell phone in your bra, shirt, or front pants pocket, especially if you're pregnant.

Explanation:

hiiiiiiiiihwdawdfgthnythgrfergthyjuhgfd

Answers

Answer:

Your answer would be gas.

Explanation:

Steam is just water just evaporated.

no i will not marry u

what actions can be performed via voice commands using 2022 versa’s siri® eyes free?

Answers

The actions that can be performed via voice commands using 2022 versa's siri® eyes free are;

- Send and receive text messages

- Make and receive calls

- Select and play music

2022 versa's siri® eyes free is a media feature that can be connected to your iPhone in the latest car by Nissan called Nissan 2022 versa.

Now Siri® Eyes Free Available functions include:

Making and receiving callsSending and reading text messagesSelecting and playing musicReading notificationsRequesting directions or other

This Siri® Eyes Free is usually located on the steering wheel and the way to operate it is by;

Press THIS button on the steering wheelSpeak a command.Wait for Siri® Eyes Free to reply. Within 5 seconds, press THIS button on the steering wheel to reply or give another command.

Read more on cars at; https://brainly.com/question/25981194

You can protect yourself from identity theft by using ____ when transmitting information over network connections. a. cookies b. port-scanning c. biometrics d. encryption

Answers

Answer:

D

Explanation:

Encryption secures transmissions on the internet to or from your PC

write a program to print. *
**
***
****
*****​

Answers

Program:-

[tex]\tt for\:i \:in\: range(2,6):[/tex]

[tex]\tt\quad for\: j\: in \:range(1,i+1):[/tex]

[tex]\tt\quad\quad print("*",end='')[/tex]

[tex]\tt\quad print()[/tex]

Output:-

[tex]\tt **[/tex]

[tex]\tt ***[/tex]

[tex]\tt ****[/tex]

[tex]\tt *****[/tex]

List three (3) features of first generation computer
PLEASE HELP!!!!!

Answers


Features of first generation computers:

Technology used: vacuum tube.

Machines languages were used to instruct the computer.

Magnetic core memory was used as primary memory.

Electrostatic tubes, Parer tape, punch card, magnetic tape.

Which of the following applies to a trademark?
o belongs to just one company or organization
O always shown on the outside of a garment
O a way for people to copy a pattern
0 a mark that represents a product's "sold"
status

Answers

Answer:

a

Explanation:

Answer:

belongs to just one company or organization

Explanation:

edge 2021

in python:
The mode of a list of numbers is the number listed most often. The median of a list of numbers is the value in the middle of the list if the list is arranged in order. For this software solution you will do the following:

Take 10 numbers as input from the user and display the number with the highest mode. If there is a tie, you will need to show all of those numbers.
Your program must create a user-defined function that takes an array of numbers as a parameter and returns the value that appears the most often in the array.
For those same 10 numbers your program must create a user-defined function that takes an array of numbers as a parameter and returns the value which is the median for those numbers.

please help!

Answers

Python can be used to implement central of tendencies such as mean, median and mode using the statistic module

The program in Python, where comments are used to explain each line is as follows:

#This imports the statistics module

import statistics

#This defines the function that calculates the mode

def calcMode(myList):

   #This prints the mode

   print(statistics.multimode(myList))

#This defines the function that calculates the median

def calcMedian(myList):

   #This prints the median

   print(statistics.median(myList))

#The main method begins here

#This initializes the list

myList = []

#The following iteration gets input for the list

for i in range(10):

   myList.append(int(input()))

#This calls the calcMode method

calcMode(myList)

#This calls the calcMedian method

calcMedian(myList)

Read more about similar programs at:

https://brainly.com/question/25026386

Do you want to run a listing to see files that were used by the last access date is date does not display by default which command would you use to find additional properties of the files to reference.

Answers

Considering the situation and the computer application, the command you would use to find additional properties of the files to reference is "Get-childitem | get-member "

What is Get-childitem command?

Get-childitem command in computer applications is used to get the items in specific locations.

Get-childitem command can be used to gets the items inside a file container, usually referred to as child items.

Similarly, the Get-member command used to gets the members, the properties, and methods of files.

Hence, in this case, it is concluded that the correct answer is Get-childitem | get-member

Learn more about Computer commands here: https://brainly.com/question/25243683

A small network that consists of devices connected by Bluetooth, such as a smartphone and a computer, is referred to as a ________.

Answers

Answer:

I think is technologies

A restaurant recorded the ages of customers on two separate days. You are going to write a program to compare the number of customers in their forties (ages 40 to 49).

What is the missing line of code?

customerAges = [33, 23, 11, 44, 35, 25, 35, 68, 51]

count40s = 0
for item in customerAges:
_____;
count40s = count40s + 1
print("Forties:", count40s)


if 40 > item > 49

if 40 < item < 49

if 40 <= item <= 49:

if 40 >= item >= 49

Answers

Answer:

if 40>= item >=49

Explanation:

to find detailed information about the origin of an email message, look at the ________________.

Answers

Email header. The email header is a code snippet in an HTML email, that contains information about the sender, recipient, email's route to get to the inbox and various authentication details

what computer is designed for particular application​

Answers

Answer: Applications for desktop or laptop computers are sometimes called desktop applications, while those for mobile devices are called mobile apps. When you open an application, it runs inside the operating system until you close it

Explanation:

Which of these would make text on a slide difficult to read?
Ohigh contrast between text and background
Olow contrast between text and background
O a sans serif font
O a large font when the presentation is in a large room

Answers

Low contrast between your text and the background

Can someone please help

Answers

Answer:

Explanation:

la reponse est le premier et le 3 eme pointcar en effet le premier point c est logiqye e le 2 e aussi  

how to send an email without showing recipients outlook

Answers

Answer:

Outlook. When you open a new blank email in Outlook, click on the “Options” tab. From there, you'll want to select the Bcc field in the message header. This is your “blind carbon copy” option, meaning that your email recipients will not see other names on the list.

Explanation:

In an attempt to reach an all-time record for its premier, ads for the highly anticipated Avengers: Endgame are run on all the major networks and cable stations across the country from 8:00 p.m. to 10:00 p.m., or during ________ time.

Answers

Based on the contextual situation, the cable stations across the country from 8:00 p.m. to 10:00 p.m., or during Late-fringe time.

What is Late-Fringe Time?

Late Fringe time is a term used in television that describes the television hours that follow the prime time.

Generally, the prime period is usually between 8:00 p.m. to 10:00 p.m., while the Late Fringe time is around 11 p.m. to 1 a.m.

Hence, in this case, it is concluded that the correct answer is "Late-Fringe period."

Learn more about Television hours here: https://brainly.com/question/1006994

You are creating a program that can add up the amount of money the user spent that day. Right down to the penny! What kind of variables should you create? a default variable a user variable an integer variable a float variable

Answers

Answer:A. A default Variable

Explanation:

Answer:

A

Explanation:

Did it on a Test

which of the following is a true statement?

A. in the customary system measurements are often expressed as decimals.

B. in the metric system measurements are often expressed as fractions.

C. in the customary system measurements are often expressed as fractions.

D. fractions are equally common in both the metric and customary systems.​

Answers

Answer:

C

Explanation:

yeah-ya........ right?

Tom is not sure how to code contents such as title and meta elements. These are coded as ____ elements.

Answers

Answer:

Tom is not sure how to code contents such as title and meta elements. These are coded as head elements.

Hope that helps. x

Answer:

head elements

Explanation:

answer is above

In 1956, the unit byte was coined by American statistician and computer scientist John Tukey
True or False (Give Explanation)​

Answers

Answer:

False

Explanation:

John Wilder Tukey was an American mathematician and statistician, best known for the development of the Fast Fourier Transform (FFT) algorithm and box plot. The Tukey range test, the Tukey lambda distribution, the Tukey test of additivity, and the Teichmüller–Tukey lemma all bear his name. He is also credited with coining the term 'bit' and the first published use of the word software.

Other Questions
How do you find the input distance What does "however" tell readers about the sentence it introduces??A that it's a sentence that will show them a differenceB that they're about to be introduced to a new ideaC that they're about to hear an example of the idea in the previous sentenceD that it's a sentence that will show them similarity 6+z=10p-5=154+m=12y-4=19b-17=123=d+2Please Show your Work The _____ of a musical composition refers to the scale that functions as the basis of the composition. what do Europes rivers suggest about early migration patterns ? HURRY!!cBoth Jeanne Kirkpatrick and Patrick Moynihan served asA. managing editors of US news organizationsB. chairmen of the Joint Chiefs of StaffC senators from New YorkD. ambassadors to the United Nations Kate owns a shoe store in Los Angeles. Whenever she orders a new style of shoe, she orders 4 pairs of that style in each of the most popular sizes. The most popular sizes are 6, 7, 8, 9, and 10. She also orders 2 pairs in size 5 and 2 pairs in size 11.For every new style, how many pairs of shoes does she need to order in total? this is the first page in the book Write an equation in slope intercept form for the graph of the line. can someone help me with this science assignment What fraction of Oklahoma workers are in manufacturing? How does this compare to the national average? PLEASE HELP ASAP!!!! 2. Why do many people have a fraught relationship with money Answer please!! I Give 20 points!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Two ratios that have the same value are called _____ ratios.productproportionequivalentunit please answer thisss (-3,5) (3,7)What is the slope of AB ? based on the diagram, which is the most reasonable hypothesis? a) metamorphic rocks never have layersb) sedimentary rocks are always the same colorc) sedimentary rocks contain grains of other rocksd) igneous rocks have layers caused by deposition Pangulong Manuel Luis Quezon at Pangala 1. Saan ipinanganak si Dr. Jose P. Laurel? d. Baguio a. Batangas b. Bulacan C. Bicol 2. Kailan siya isinilang? d. Marso 9,1 a. Marso 9, 1991 b. Marso 9, 1881 C. Marso 9, 1981 3. Ano ang unang tungkulin ni Dr. Jose P. Laurel bago siya naging pangul bansa? a. Senador b. Kalihim C. Mayor d. Gobernada 4. Aling bansa sakop ang Pilipinas noong naging pangulo siya? a. Amerika b. Espanya c. Hapon d. Tsina 5. Ano ang pinakamalaking pagsubok niya bilang pangulo ng bansa sa panahon Hapon? a. Masayang makasama ang mga Hapon. c. Mahirap magpasya bilang pinun b. Magaan makausap ang mga Hapon. d. Hindi magkaintindihan dahil sa wika is 'the colour' a noun phrase If the base of the parallelogram is 8 and the perimeter is 28 then what is the area?