• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            Impossible is nothing  
              愛過知情重醉過知酒濃   花開花謝終是空   緣份不停留像春風來又走   女人如花花似夢
            公告
            日歷
            <2025年8月>
            272829303112
            3456789
            10111213141516
            17181920212223
            24252627282930
            31123456
            統計
            • 隨筆 - 8
            • 文章 - 91
            • 評論 - 16
            • 引用 - 0

            導航

            常用鏈接

            留言簿(4)

            隨筆分類(4)

            隨筆檔案(8)

            文章分類(77)

            文章檔案(91)

            相冊

            搜索

            •  

            最新評論

            閱讀排行榜

            評論排行榜

             
            I/O流控制:
            (1)控制浮點數值顯示可用setprecision(n) 控制輸出流顯示浮點數的數字個數,默認輸出有效值為6位。
               setiosflags(ios::fixed) 用定點方式表示實數
               seiosflags(ios::scientific) 用指數方式表示實數
                   setiosflags(ios::fixed)與seiosflags(ios::scientific)都可以和setprecision(n)合用,其效果分別為:控制小數點右邊的數字個數,控制指數表示法的小數位數。
               在用浮點表示的輸出中,setprecision(n)表示有效位數。
               在用定點表示的輸出中,setprecision(n)表示小數位數。
               在用指數形式輸出時,setprecision(n)表示小數位數。
               小數位數截短顯示時,進行4舍5入處理。
            // 測試環境:Visual Studio.net 2003 C++
            #include "stdafx.h"
            #include <iomanip>
            #using <mscorlib.dll>
            using namespace System;
            using namespace std;
            void _tmain()
            {
                 double amount=22.0/7;
                 cout <<amount <<endl;
                 cout <<setprecision(1) <<amount <<endl
                      <<setprecision(2) <<amount <<endl
                      <<setprecision(3) <<amount <<endl
                      <<setprecision(4) <<amount <<endl;
                
                    cout <<setiosflags(ios::fixed);
                 cout <<setprecision(8) <<amount <<endl;
                
                    cout <<setiosflags(ios::scientific) <<amount <<endl;  // setiosflags(ios::fixed)定義在setiosflags(ios::scientific)前則指數形式不能被正確的輸出。
                
                    cout <<setprecision(6);
            }
             
            (2)左右對齊輸出可用setiosflags(ios::left)setiosflags(ios::right)實現。
            #include "stdafx.h"
            #include <iomanip>
            #using <mscorlib.dll>
            using namespace System;
            using namespace std;
            void _tmain()
            {
                 cout <<setiosflags(ios::right)  // 交換setiosflags(ios::right)與setiosflags(ios::left)的位置可以實現先左后右對齊,否則都位右對齊
                      <<setw(5) <<1
                      <<setw(5) <<2
                      <<setw(5) <<3 <<endl;
                 cout <<setiosflags(ios::left)
                      <<setw(5) <<1
                      <<setw(5) <<2
                      <<setw(5) <<3 <<endl;
            }
             
            (3)設置填充字符可用setwsetfill實現。setw用來確定顯示的寬度,setfill用來確定一個非空格的特別字符(設置填充的字符)。
            (4)強制顯示小數點和符號可用setiosflags(ios::showpoint) setiosflags(ios::showpos) 實現。
            posted on 2006-03-02 22:10 笑笑生 閱讀(221) 評論(0)  編輯 收藏 引用
             
            Copyright © 笑笑生 Powered by: 博客園 模板提供:滬江博客
            久久久久人妻一区精品色| 精品久久久久久国产| 国产女人aaa级久久久级| 精品久久人人爽天天玩人人妻 | 99久久国产综合精品女同图片 | 久久超乳爆乳中文字幕| 91精品国产91热久久久久福利| 欧美日韩久久中文字幕| 国产成人精品久久一区二区三区| 一本大道久久东京热无码AV| 久久久久久久尹人综合网亚洲| 午夜精品久久久久久毛片| 国产精品久久久香蕉| 国产香蕉97碰碰久久人人| 中文字幕乱码久久午夜| 久久性生大片免费观看性| 国产精品久久久99| 99久久精品免费看国产一区二区三区| 日韩精品国产自在久久现线拍 | .精品久久久麻豆国产精品| 国产A三级久久精品| 色青青草原桃花久久综合| 亚洲乱码日产精品a级毛片久久 | 久久久久久久国产免费看| 狠狠久久综合| 久久97久久97精品免视看 | 一本大道久久香蕉成人网| 91精品观看91久久久久久| 日本精品久久久久中文字幕8| 亚洲午夜无码久久久久| 久久婷婷国产剧情内射白浆| 国内精品久久久久影院亚洲| 久久99热这里只有精品国产 | 亚洲va中文字幕无码久久不卡| 亚洲欧美国产精品专区久久| 欧美性猛交xxxx免费看久久久| 久久婷婷国产剧情内射白浆| 久久亚洲熟女cc98cm| 99精品国产99久久久久久97 | 日韩精品久久无码中文字幕| 四虎国产精品免费久久5151|