0

Write a function called calc() that receives two real numbers and a character and returns the sum, difference, product or quotient of the two numbers passed to it depending on whether the character is equal to a '+', '-', '*' or '/', respectively.

Write another function that displays the following:
Select one of the following:

1.Add
2.Subtract
3.Multiple
4.Divide
Enter your selection:

and returns the user's choice.

In main, continue to ask the user to calculate and if he or she enters 'y' or 'Y', read two real numbers from him/her, call the menu() function and pass the two numbers and the chararacter (+, -, *, / depending on whether add, sub, mul, or div was selected) to the calc() function and print the result returned by calc() until the user enters other than 'y' or 'Y'.

can you guys help me with this assignment? functions were easy in the beggining of the chapter but this i jus dont get at all. seems so easy yet i dont know where to begin ahh

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by Duoas
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.