c++编程题:体重,身高单位转换~

来源:百度知道 编辑:UC知道 时间:2024/06/04 16:44:02
要求输入体重(磅)。身高(英寸),程序输出体重(千克),身高(米)
1千克=2.2磅。1英寸=0.0254米

/*帮你写好了,可以通过编译*/

#include<iostream>
#include <conio.h>

using namespace std;

void main()
{
    double weight,height;

    cout << "输入体重(磅):";
    cin >> weight ;
    cout << "输入身高(英寸):";
    cin >> height ;

    //开始转换 1千克=2.2磅。1英寸=0.0254米
    weight /= 2.2;
    height *= 0.0254;

    cout << "体重(千克):" << weight << "\t身高(米):"<< height <<endl;

    cout<<"Press any key to exit";
  &