栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > C/C++/C#

【C熟肉】据父母身高及自己习惯判断身高

C/C++/C# 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

【C熟肉】据父母身高及自己习惯判断身高

#include

int main()
{
	int sex, sports, diet;
	double myheight=0, faheight, moheight;
	printf("请输入你的性别(男1/女0)n你父亲的身高n你母亲的身高n是否爱锻炼(是1/不是0)n是否有好的饮食习惯(有1/没有0)n");
	scanf_s("%d%lf%lf%d%d", &sex, &faheight, &moheight, &sports, &diet);

	switch (sex)
	{
	case 1:
	{
		if (sports == 1 && diet == 1)
			myheight = (faheight + moheight) * 0.54 * 1.035;
		if (sports == 1 && diet == 0)
			myheight = (faheight + moheight) * 0.54 * 1.02;
		if (sports == 0 && diet == 1)
			myheight = (faheight + moheight) * 0.54 * 1.015;
		if (sports == 0 && diet == 0)
			myheight = (faheight + moheight) * 0.54;
		printf("你的身高可能是:%5.2f cm", myheight); break;
	}

	case 0:
	{
		if (sports == 1 && diet == 1)
			myheight = (faheight * 0.923 + moheight) / 2 * 1.035;
		if (sports == 1 && diet == 0)
			myheight = (faheight * 0.923 + moheight) / 2 * 1.02;
		if (sports == 0 && diet == 1)
			myheight = (faheight * 0.923 + moheight) / 2 * 1.015;
		if (sports == 0 && diet == 0)
			myheight = (faheight * 0.923 + moheight) / 2;
		printf("你的身高可能是:%5.2f cm", myheight); break;
	}
	}
}
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/630358.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号