I am having to write a math tutorial program for a lab. To contain all 4 basic math functions, add, subtract, multiply, & divide. Using the rand num generator to supply to numbers to user and a CIN for them to answer.
I've been able to set them all up with relative ease with the exception of the division tutor. Problem I'm having is rand num generator is populating numbers that when divided and the answer has infinite decimal values the user has no way of answering correct.
For example 10/3 is 3.333333
I know how to use set precision for output values but how do round the assigned value of a variable to the nearest tenth or hundredth decimal place? The instructions say the program should be written for 4th to 6th graders and I know the division tutor should allow the users to answer to at least 1 remainder.
Any ideas on how to accomplish this?
Rounding in C++
Post a Reply
|Oldest Newest Rating|
Used in many types of software including music players, video games, and many large scale applications.
|Bucky Roberts Administrator|