while_cf.cpp

来自「在c环境下的对数据结构进行讲解,包含有例题及答案」· C++ 代码 · 共 18 行

CPP
18
字号
  //while_CF.cpp
 #include <iostream.h>					//cout
 #include <conio.h>					//getch()
 void main()
 { double c=20,f;
   cout << "  C     F\n";
   cout.setf(ios::showpoint);			//显示小数点
   cout.setf(ios::fixed,ios::floatfield);	//先清小数字段再设置点小数
   cout.precision(1);  					//一位小数
   while (c<=25.0)
   { f = 9.0/5.0*c + 32.0;				//摄氏转华氏公式
     cout.width(5); cout << c;			//设列宽并输出
     cout.width(6); cout << f << endl;
     c++;							//改变条件的语句
   }
   getch();						//暂停
 }

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?