📄 while_cf.cpp
字号:
//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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -