/*编写一个小程序,要求用户输入一个自己的身高(厘米),将身高转换为米和厘米,该程序
使用下划线字符来提示输入位置,另外,使用一个const符号常数来表示转换因子*/
#include <iostream>
using namespace std;
int main()
{
int height;
cout << "输入你的身高(单位厘米):___\b\b\b";
cin >> height;
int const n = 100;
int height2;
height2 = height / n;
float height3;
height3 = height % n;
cout << "你的身高是:" << height2 << "米" << ' ' << height3 << "厘米" << endl;
system("pause");
return 0;
}
使用下划线字符来提示输入位置,另外,使用一个const符号常数来表示转换因子*/
#include <iostream>
using namespace std;
int main()
{
int height;
cout << "输入你的身高(单位厘米):___\b\b\b";
cin >> height;
int const n = 100;
int height2;
height2 = height / n;
float height3;
height3 = height % n;
cout << "你的身高是:" << height2 << "米" << ' ' << height3 << "厘米" << endl;
system("pause");
return 0;
}
这是一个简单的C++程序,用于将用户输入的身高从厘米转换为米和厘米,并使用下划线字符作为输入提示。程序通过定义一个常量来进行单位换算。
14万+

被折叠的 条评论
为什么被折叠?



