第三次上機實驗報告
阿新 • • 發佈:2019-01-27
/* * 檔名稱:Ex1-1.cpp * 作 者:岑榮 * 完成日期:2016 年 3月 24 日 * 版 本 號:v1.0 * 對任務及求解方法的描述部分: * 輸入描述:計算程式描述人的體重 * 問題描述:如何計算一個人的標準體重 * 程式輸出: 超重超輕正常 * 問題分析:如何判斷一個人體重是否正常 * 演算法設計: 體重>正常體重*1.2=超重;體重<正常體重*0.8=超輕 */ #include<iostream> #include<cmath> using namespace std; int main() { int height,weight,stWeight; cout<<"請輸入身高和體重:"; cin>>height>>weight; stWeight=h6eight-100; if(weight>stWeight*1.2) { cout<<stWeight<<"超重"<<endl; } else if(weight<stWeight*0.8) { cout<<stWeight<<"超輕"<<endl; } else { cout<<"正常"<<endl; } return 0; }