Fat Man can't hurt!

Source: Internet
Author: User

according to the weight standards recommended by the World Health Organization, men's standard weight = (height cm-80) X70﹪, women's standard weight = (height cm-70) X60﹪. The standard body weight positive and negative 10﹪ is normal body weight, the standard body weight positive and negative 10﹪~ 20﹪ is overweight or excessively light, the standard body weight and positive 20﹪ above is obese or underweight, in which the overweight formula is: overweight (%) =[(actual weight-standard weight)/(standard body weight)]x100%, body weight is kg.
please write a program, enter a person's name, gender, height, weight, with a strong human voice to output their weight (normal, overweight, too light, fat or underweight), the program can be used in the scale for people to report the weight of the situation in real time.

Requires that a struct type be used to represent information about a person.



#include <iostream>using namespace std;struct person{    char name[20];    char sex;    Double height;    double weight;}; int main () {    Double St, over;    person p;    cout<< "Please enter your name:";    cin>>p.name;    cout<< "Please enter your gender (f/m):";    cin>>p.sex;    cout<< "Please enter your elevation (cm):";    cin>>p.height;    cout<< "Please enter your weight (kg):";    cin>>p.weight;    if (p.sex== ' F ' | | p.sex== ' F ')        st= (p.height-70) *0.6;    else        st= (p.height-80) *0.7;    Over= (p.weight-st)/st;    if (over>0.2)        cout<< "Would you be a sumo wrestler?" "<<endl;    else if (over>0.1)        cout<< "You have to control your diet!" Eat more so you can go to sumo. ╮(╯▽╰)╭ "<<endl;    else if (over>-0.1)        cout<< "(⊙o⊙) Ah!!! You're in good shape! Envy%>_<% "<<endl;    else if (over>-0.2)        cout<< "eat some more!" "<<endl;    else        cout<< "You are so .... The wind can blow you down! Hurry up and eat a little more fat! "<<endl;    return 0;}


Fat Man can't hurt!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.