Leveling path starting from 0 (a) - ternary operator and the digits after the decimal retention

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)

Guess you like

Origin www.cnblogs.com/Ricardohff/p/12452744.html