我正在尝试将我的最终答案四舍五入到小数点后两位,所以它是美元和美分。我是编码新手,无法弄清楚。我想在“您需要收取的金额是”的行中将“w”四舍五入这是我的代码:
#include <iostream>
using namespace std;
int main()
{
string Choice;
float x, w;
cout << "Please enter the amount needed." << endl;
cin >> x;
w = x/(1-0.0275);
cout << "The amount you need to charge is $"<< w << "." << endl;
return (0);
}