栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > C/C++/C#

C++ IO库探索(#include <ciomanip>)

C/C++/C# 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

C++ IO库探索(#include <ciomanip>)

#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

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/1019108.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号