+ 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; }

4th Aug 2022, 8:09 PM
Angel Jimenez
Angel Jimenez - avatar
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/
4th Aug 2022, 8:24 PM
Jayakrishna 🇼🇳
+ 1
Thanks got it
4th Aug 2022, 9:43 PM
Angel Jimenez
Angel Jimenez - avatar