#include#include #include using namespace std; int main() { cout << "default bool values: " << true << ' ' << false << "nalpha bool values: " << boolalpha << true << ' ' << false << endl; cout << true <<' '<< false << endl; cout << noboolalpha << true << ' ' << false << endl; cout << "deafult: " << 20 << ' ' << 1024 << endl; cout << "octal: " << oct << 20 << ' ' << 1024 << endl; cout << "hex: " << hex << 20 <<' ' << 1024 << endl; cout << "80 become decimal before: " << 80 << endl; cout << "decimal: " << dec << 20 <<' ' << 1024 << endl; cout << showbase; cout << "deafult: " << 20 << ' ' << 1024 << endl; cout << "octal: " << oct << 20 << ' ' << 1024 << endl; cout << "hex: " << hex << 20 <<' ' << 1024 << endl; cout << "80 become decimal before: " << 80 << endl; cout << "decimal: " << dec << 20 <<' ' << 1024 << endl; cout << noshowbase; cout << uppercase << showbase << "using upper in hex: " << hex << 20 <<' ' << 1024 << nouppercase << noshowbase << dec << endl; cout << "Precision: " << cout.precision() << " ,value: " << sqrt(3.0) << endl; cout.precision(12); cout << "Precision: " << cout.precision() << " ,value: " << sqrt(3.0) << endl; cout << setprecision(3); cout << "Precision: " << cout.precision() << " ,value: " << sqrt(3.0) << endl; cout << "deafult format " << 100*sqrt(3.0) << 'n'; cout <<"scientific " << scientific << 100*sqrt(3.0) << 'n'; cout << "fixed decimal: " < 代码结果:
default bool values: 1 0
alpha bool values: true false
true false
1 0
deafult: 20 1024
octal: 24 2000
hex: 14 400
80 become decimal before: 50
decimal: 20 1024
deafult: 20 1024
octal: 024 02000
hex: 0x14 0x400
80 become decimal before: 0x50
decimal: 20 1024
using upper in hex: 0x14 0x400
Precision: 6 ,value: 1.73205
Precision: 12 ,value: 1.73205080757
Precision: 3 ,value: 1.73
deafult format 173
scientific 1.732e+002
fixed decimal: 173.205
hex :0xa.d34802c27df28p+4
using deafult : 173
10
10.0 10.0
i: -12next col
db: 3.14next col
i: -12next col
db: 3.14next col
i: -12 next col
db: 3.14 next col
i: -12next col
db: 3.14next col
i: *********-12next col
db: ********3.14next col
Hello world!
Precision: 3 ,value: 1.73205080757
Precision: 12 ,value: 1.73205080757
Precision: 12 ,value: 1.732050808
Precision: 10 ,value: 5
10 10000000
00003
3



