1 answer

Write a driver C++ program that will test the following functions in the same order they...

Question:

Write a driver C++ program that will test the following functions in the same order they are written next. You can test your program by reading the following values: n1= 10 and n2= 20 from the user:

The main program sends the values of the variables n1 and n2 to the function. The function calculates the average and sends it back to main program through the parameter list as call by reference parameter and will not use the return statement.


Answers

#include <bits/stdc++.h>
using namespace std;

void cal_avg(int a,int b,double &avg){
avg = (a+b)/2.0;
}

int main(){
int a,b;
cin >> a >> b;
double avg;
cal_avg(a,b,avg);
cout << avg << endl;
return 0;
}

.

Similar Solved Questions

1 answer
Enter your answer in the provided box. A sample of carbon monoxide occupies 6.64 L at...
Enter your answer in the provided box. A sample of carbon monoxide occupies 6.64 L at 296.0 K and 739 torr. Find its volume at -21°C and 373 torr....
3 answers
How do you rationalize the denominator of #1/(sqrt(2)+sqrt(3)+sqrt(5))#?
How do you rationalize the denominator of #1/(sqrt(2)+sqrt(3)+sqrt(5))#?...
1 answer
QUESTION 15 Respiratory failure resulting from acute inflammation in the lungs, injury to capillaries in the...
QUESTION 15 Respiratory failure resulting from acute inflammation in the lungs, injury to capillaries in the alveoli of the lungs, pulmonary edema, and lack of oxygenation of the blood is called what? DIC Septic shock ARDS Ischemia Hypovolemia...
1 answer
Data Structures/Automata/Graph Theory Question: Problem 1 Find the strongly connected components of the graph shown on...
Data Structures/Automata/Graph Theory Question: Problem 1 Find the strongly connected components of the graph shown on Figure1 Figure 1:...
1 answer
Required information [The following information applies to the questions displayed below.] Cardinal Company is considering a...
Required information [The following information applies to the questions displayed below.] Cardinal Company is considering a five-year project that would require a $2,955,000 investment in equipment with a useful life of five years and no salvage value. The company's discount rate is 16%. The pr...
1 answer
Which of the following generate the type of externality previously described? Check all that apply. A...
Which of the following generate the type of externality previously described? Check all that apply. A microbiology lab has published its breakthrough in swine flu research. Your roommate Deborah has bought a puppy that barks all day while you are trying to study economics. Van has planted several tr...
1 answer
If you deposit $350 each month into an individual retirement account (RA) earning 6% APR interest,...
If you deposit $350 each month into an individual retirement account (RA) earning 6% APR interest, how much will you have in the account after 25 years? Answer:...
1 answer
Be sure to answer all parts. Calculate the pH of each of the following solutions. (a)...
Be sure to answer all parts. Calculate the pH of each of the following solutions. (a) 4.1 × 10−4 M Ba(OH)2: × 10 (Enter your answer in scientific notation.) (b) 2.3 × 10−4 M HNO3:...
1 answer
Suppose a stock had an initial price of $72 per share paid a dividend of $120...
Suppose a stock had an initial price of $72 per share paid a dividend of $120 per share during the year, and had an ending share price of $79. Compute the percentage total return (Round your answer to 2 decimal places. (e.g. 32.16)) Total return Hints References eBook & Resource...
1 answer
The heater used in a 4.32 m×3.55 m×2.91 m dorm room uses the combustion of natural...
The heater used in a 4.32 m×3.55 m×2.91 m dorm room uses the combustion of natural gas (primarily methane gas) to produce the heat required to increase the temperature of the air in the dorm room. Assuming that all of the energy produced in the reaction goes towards heating only the air ...
1 answer
Steve Reese is a well-known interior designer in Fort Worth, Texas. He wants to start his...
Steve Reese is a well-known interior designer in Fort Worth, Texas. He wants to start his own business and convinces Rob O’Donnell, a local merchant, to contribute the capital to form a partnership. On January 1, 2016, O’Donnell invests a building worth $108,000 and equipment valued at $...
1 answer
Break-even analysis for a service company Rotelco is one of the largest digital wireless service providers...
Break-even analysis for a service company Rotelco is one of the largest digital wireless service providers in the United States. In a recent year, it had approximately 100 direct subscribers (accounts) that generated revenue of $43,800. Costs and expenses for the year were as follows: Cost of revenu...
1 answer
Please explain your solutions. thank you so much 3. The chemistry of nitrogen oxides is very...
please explain your solutions. thank you so much 3. The chemistry of nitrogen oxides is very versatile, Given the following reactions and their standard enthalpy changes (1) NO(g) + NO:(g) → N;O;(g) AH° = -39,8 kJ (2) NO(g) + NO:(g) 0:(g) → N;O:(g) AH° = -1125 kJ (3) 2NO:(g) &r...
1 answer
Web Cites Research projects a rate of return of 20% on new projects. Management plans to...
Web Cites Research projects a rate of return of 20% on new projects. Management plans to plow back 30% of all earnings into the firm. Earnings this year will be $3 per share, and investors expect a 12% rate of return on stocks facing the same risks as Web Cites. a. What is the sustainable gr...
1 answer
Term Description Risk A. The term applied to the risk of an asset that is measured...
Term Description Risk A. The term applied to the risk of an asset that is measured by the standard deviation of the asset's expected returns. That portion of an investment's risk calculated as the difference between its total risk and its firm-specific risk. Expected rate of return B. Beta c...
1 answer
Need help. Thanks 2. Draw the structure(s) of the following chemical reactions. Where appropriate indicate which...
Need help. Thanks 2. Draw the structure(s) of the following chemical reactions. Where appropriate indicate which product is the major and minor product (10 points) Dehydration of 2-methyl-2-pentanol Oxidation of 2-methyl-2-pentanol...
2 answers
F) in vacuum, light travels at about 186,282 miles per second. One mile is about 161...
f) in vacuum, light travels at about 186,282 miles per second. One mile is about 161 kilometers (km). Astronomers prefer to use units of distance that are reasonable in describing how far objects are from Earth. For example, for distances in the solar system we use the astronomical unit (AU), which ...
1 answer
1. What are your 2 most important ideas related to Professionalism and why? 2. What are...
1. What are your 2 most important ideas related to Professionalism and why? 2. What are you 2 most important ideas related to Networking yourself and why? 3. List 2 employers you visited with, their role and organization, and explain the most intriguing question they were asked and their response....