how to round a double to 2 decimal places in c++
#include <iostream>
#include <iomanip>
#include <cmath>
int main() {
double number = 123.45678;
// Round to 2 decimal places
double roundedNumber = round(number * 100) / 100;
// Display the rounded number
std::cout << std::fixed << std::setprecision(2) << roundedNumber;
return 0;
}