The first is to retain the number of decimal places :
Iomanip first come first document contains, and then floating-point n (2 decimal places assumption) by the following output:
cout<<setiosflags(ios::fixed)<<setprecision(2)<<n<<endl;
Ternary operator stepped pit:
Figure:
Ternary operator to ":" back, if there are a plurality of first identification statement is only (if not in parentheses)