记录下我最近学习写的程序,新手,,分享下。
程序代码://身高预测代码
#include<stdio.h>
#include<math.h>
void main()
{
char sex,sports,diet;
float faHeight,moHeight,person;
printf("Enter sex boy(M) or girl(F):");
scanf("%c%*c",&sex);
printf("Enter your fatherHeight and motherHeight:");
scanf("%f%f",&faHeight,&moHeight);
printf("wether like sports(Y/N):");
scanf("%c%*c",&sports);
printf("wether have ballence's diet(Y/N):");
scanf("%c%*c",&diet);
if(sex=='M'||sex=='m')
person=(faHeight+moHeight)*0.54;
else
person=(faHeight*0.923+moHeight)/2;
if(sports=='Y'||sports=='y')
person*=0.02;
if(diet=='Y'||diet=='y')
person*=0.015;
printf("your height is:%.3fcm\n",person);
}[ 本帖最后由 ZJQLOVELYY 于 2012-1-21 16:15 编辑 ]









