C++実験2:標準体重

1253 ワード

一.問題とコード
/*  
*     :andy.cpp  
*       :   
*     :2016    3  24    
*      :v1.0  
*              : 
*     :   
*     :     C++  ,       、     
*     :“       ”  
*     :  
*     :   
*/   
#include<iostream.h>
#include<cmath>
void main()
{
	int height,weight,stweight;
	cout<<"        ";
	cin>>height>>weight;
	stweight=height-100;
	if(weight>stweight*1.2)
		cout<<"sorry,you are overweight"<<endl;
	else if(weight<stweight*0.8)
	    cout<<"dear,you should eat more"<<endl;
    else
	    cout<<"you are healthy"<<endl;
}
<img src="http://img.blog.csdn.net/20160324113618732?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" />
       ,       ,        ,                。                ,           ,                。
        ,   if,else if,else         ,               。