我创建了一个程序,将真实(巴西硬币)转换为美元,硬币是4位数,浮动变量更多:
#include <iostream>
using namespace std;
int main(int nNumberofArgs, char* pszArgs[]){
float fReal;
cout << "enter the cash in real: R$:";
cin >> fReal;
float fDollar = fReal / 3.90;
cout << "your cash in dollar(s): " << fDollar << endl; // Here i want
//:.2f(from python) to the dollar value
cout << "Press enter to continue..." << endl;
cin.ignore(10, '\n');
cin.get();
return 0;
}
std::cout << std::setprecision(2)<< fDollar<<'\n';