一、问题及代码
#include <iostream>
using namespace std;
int main()
{
double x,y,z;
cout <<"输入身高x和体重y:";
cin >>x>>y;
z=(y-x+100)/(x-100);
if(z>=0.2)
cout <<"超重";
if(z<0.2&&z>=-0.2)
cout <<"正常";
else
cout<<"超轻";
return 0;
}
二、结果运行
三、心得体会
c++编程语言可以简化生活中很多问题。
四、知识点总结
if语句中如果包含两个条件应该用&&连接,一个else对应紧挨着的if