+ 1
Kelidascope help
How do i round it to the nearest second decimal point #include <iostream> using namespace std; int main() { int buy; cin>>buy; double kaleidoscope=5; double saleP=buy*kaleidoscope; if (buy>=2){ saleP =saleP -saleP*.1; cout<<saleP+.07*saleP;} else cout<<saleP+.07*saleP; return 0; }
2 Answers
+ 2
Angel Jimenez
Use <iomanip>header manipulators: fixed and setprecision
cout<<fixed<<setprecision(2)<<saleP+.07*saleP;
https://m.cplusplus.com/reference/iomanip/setprecision/
+ 1
Thanks got it