/* round.cpp Written by Warren M Myers 19 Jun 2000 Usage and explanation below. */ #include /* function to round any number at a given precision */ /* precision is factor of ten, (1000ths would be 3 precision) */ /* defaults to 2 precision, for money */ /* works for rounding decimals only, not whole numbers */ /* Usage: ans = Round(number, d); --> round number at d decimal points and put the result into the variable ans. ans = Round(7.3429562, 2); --> round the number 7.3429562 at 2 decimal points and put the answer into ans (ans = 7.34) */ /* To use in program: add this line: #include "round.cpp" or: #include "round.h" and compile with multiple .cpp files */ long double Round(long double number, unsigned long int precision = 2){ unsigned long int tenFactor = 10; unsigned long int intermediateAnswer = 0; unsigned long int loopCount = 0; long double result; for(;loopCount