#include<iostream>
#include<iomanip>           //<iomanip>為輸出格式標頭檔
using namespace std;
int main()
{
    float a;
    cout<<"攝氏   華氏"<<endl;
    int b;
    for(b=0;b<=10;b++)               //for(初始值設定;條件判斷式;參數改變式)
      {
      a=5.0*b;
      cout<<setw(3)<<a<<"    "<<setw(3)   //setw(n)為<iomanip>中的欄位寬度設定
          <<a*9.0/5.0+32.0<<endl;            
      }
      system("pause");
      return 0;
    }

 

輸出結果:

攝氏   華氏
  0     32
  5     41
 10     50
 15     59
 20     68
 25     77
 30     86
 35     95
 40    104
 45    113
 50    122
請按任意鍵繼續 . . .

arrow
arrow
    全站熱搜

    霄狼一哥 發表在 痞客邦 留言(0) 人氣()