CMIS 140
Lab exercise
Fun with reference arguments.
Change change.cpp so that money is an int. This will eliminate
roundoff errors.
Then modify it so it returns the total number of coins.
********************
Back to quadratic function program. Make a function that does the
quadratic function. a, b, and c are pass by value arguments. The two
possible x values are reference arguments. The return value of the
function will be the number of solutions (i.e. the number of x's that
have values).
...
Use of the function will be something like:
int solutions;
float a,b,c,x1,x2;
cin >> a >> b >> c;
solutions = quadratic(a,b,c,x1,x2);
if (solutions == 0)
cout << "No solutions";
else if (solutions == 1)
cout << x1;
else
cout << x1 << " " << x2;
*******************
Write a function that inputs a specified number of numbers from the
user, bringing back in reference arguments the sum of the numbers and
their average. The number of numbers is a pass by value argument.
Typical use of the function:
int num_nums;
float sum, average;
cin >> num_nums;
get_em_sum_em_average_em(num_nums,sum,average);
cout << "sum is " << sum << " average is " << average;