// class 3 demo 3 #include #include using namespace std; int main() { double num = 0.0; double roundedNum = 0.0; cout << "Enter a number with more than 2 decimal places: "; cin >> num; roundedNum = (int ((num * 100) + 0.5))/ 100.0; // or // roundedNum = (int ((num * 100) + 0.5))/ 100.0; using old-fashioned type casting // or // roundedNum = (floor ((num * 100) + 0.5))/ 100.0; using the floor library function // from cmath or math.h which must be // included at the top of the program cout << num << " rounded to the nearest hundredth's is " << roundedNum << endl; return 0; } //end of main