Starting from:

$25

Lab 7

1 swapref.cpp Write a function that will swap two integers values using pass by reference ( i.e. alias) parameters. Write a driver program to test your function.
2 check.cpp Write a function with the following prototype:
bool compute(int one, int two, int & sum, int & product, int & quotient);
sum will be one + two, product will be one * two, and quotient will be one/ two provided that two is not 0. If the quotient can be computed,( i.e. two is not 0 ) return true. If the
quotient cannot be computed,( i.e. two has a value of 0 ) return false.

Write a driver program to test both cases.

3. overload.cpp Overload 4 sum functions int sum(int, int);
int
sum(int,int,int);int sum(int,int,int,int);
int sum(int,int,int,int,int);
each sum function should return the sum of all of the int parameters. Write your code
so that each of the last 3 sum functions calls the one listed before it. For example,
int sum( int,int,int,int,int) should callthe function int sum(int,int,int,int)


Write a driver program to test all 4 functions

4 box.cpp Overload displayBox function – uses loops
Complete the program template box.cpp

Use input data of 5 ? 15 4$

NOTE: Only one of your overloaded functions needs the details of nested loops, the other 3 SHOULD call the one that has the details.

NOTE: box(5) will display

xxxxx

x x

x x

x x xxxxx
box(5,7,’a’) will display
xxxxx xaaax
xaaax
xaaax
xaaax
xaaax


xxxxx

5 Write a function that has two parameters: - an integer that is a test score
- and a second parameter that is the letter grade.

The function will place a value in the second parameter

Use the standard grading scale for A, B, C, D,
F. If the score is above 100 or below 0, a grade will not be assigned and a return value of false will be returned. If the score is within range, a return value of true will be returned and the letter grade will be placed in the second parameter.
The prototype for the function is: bool figureGrade(int, char &);
Write a main function to test the function you have written.

More products