C++ Functions Exercises
1. The program will choose a random operation(either Addition, Subtraction, Multiplication,
Division, or Modulus in functions). Then it asks the user to input two integer values for the
calculation(call a function operation). The program also asks the user to decide whether
he/she wants to continue the operation. If he/she input ‘y’, the program will choose and prompt
a random operation again. Otherwise, the program will terminate.
Example:
Random Operation: Addition
Enter your two numbers: 12 15
Result: 27
2. Write a C++ functions to sort 10 integer values, or 10 long values, or 10 double values.
3. Write a C++ program with a function that receives a factor and will output the multiplication
table as shown below:
Enter the factor: 3
3*1=3
3*2=6
3*3=9
3 * 4 = 12
3 * 10 = 30
4. Modify the problem in #3, such that it will generate random number as a factor from 1-10, and
call the function that receives a factor and will output the multiplication table as shown below:
Random factor: 5
5*1=5
5 * 2 = 10
5 * 3 = 15
5 * 4 = 20
.
.
5 * 10 = 50
5. Modify the problem in #4, such that it will generate random number as a factor from 10-99, and
call the function that receives a factor and will output the multiplication table as shown below:
Random factor: 33
33 * 1 = 33
33 * 2 = 66
33 * 3 = 99
33 * 4 = 132
.
.
.
33 * 10 = 330