第二次项目 三合一

项目一:标准体重

#include<iostream>
using namespace std;
int main()
{
	double weight,high,bweight;
	cout<<"请输入身高和体重:";
	cin>>high>>weight;
	bweight=high-100;
	if(weight>bweight*(1+0.2))
		cout<<"超重"<<endl;
	else if(weight<bweight*(1+0.2))
		cout<<"超轻"<<endl;
	else
		cout<<"正常"<<endl;
	return 0;
}


 

项目二:分段函数求值

#include<iostream>
using namespace std;
int main()
{
	int x,y;
	cout<<"请输入整数x的值"<<endl;
	cin>>x;
	if(x>=1)
		y=x-1;
	else
	    y=-x+1;
	cout<<"对应y值为"<<y<<'\n';
		return 0;
}


项目4:模拟ATM

#include<iostream>
using namespace std;
int main()
{
	cout<<"黄氏银行欢迎您"<<endl;
	cout<<"请输入密码:"<<endl;
	int password;
	cin>>password;
	if(password==980309)
		cout<<"1.查询"<<'\n'<<"2.取款"<<'\n'<<"3.存款"<<'\n'<<"4.转账"<<'\n'<<"0.退出"<<endl;
	else
	    cout<<"密码错误"<<endl;
	return 0;
}


 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值