8: Function Question 1: CS2311 – Yang, QingXiong

advertisement
CS2311 – Yang, QingXiong
8:
Function
Question 1:
Write a C++ program that will display the calculator menu. The program will prompt the user to
choose the operation choice (from 1 to 5). Then it asks the user to input two integer vales for
the calculation. See the sample below.
The program also asks the user to decide whether he/she wants to continue the operation. If
he/she input ‘y’, the program will prompt the user to choose the operation gain. Otherwise, the
program will terminate. You need to write a function to display the operation choice, and five
functions for the five different operations.
Question 2
Write a function that calculates base ^ exponent where base and exponent are two
integer variables obtained from user input. Declare your own function as “int
mypower(int base,int exponent)”.
Download