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

Remember the switch statement.

Good luck.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.