山东大刀
我的第一个程序
>>
完整版
#include<stdio.h>
#include<stdlib.h>
main()
{
char sex, sport, diet;
int faHeight, maHeight, Height;
printf("请输入性别,男为M女为F:\n");
sex = getchar();
printf("请输入您的父亲身高:\n");
scanf("%d",&faHeight);
printf("请输入您的母亲身高:\n");
scanf("%d",&maHeight);
printf("是否喜欢体育锻炼Y/N:\n");
getchar();
sport = getchar();
printf("是否有良好的饮食习惯Y/N:\n");
getchar();
diet = getchar();
if(sex == 'M')
Height = (faHeight + maHeight)* 0.54;
else
Height = (faHeight * 0.923 + maHeight)/2;
if(sport == 'Y')
Height = (Height * 1.02) ;
else
Height = Height;
if(diet == 'N')
Height = (Height * 1.015) ;
else
Height = Height;
printf("您的预测身高为=%d\n",Height);
system("pause");
}