您的位置:首页 > 编程语言 > C语言/C++

C++作业2

2016-03-30 23:41 176 查看
一、

#include<iostream>
using namespace std;
int main()
{
int x,y;
cout<<"input x:";
cin>>x;
if(x>=1)
y=x-1;
else
y=-x+1;
cout<<"y="<<y;
}
二、

#include<iostream>
using namespace std;
int main()
{
int h,w,x;
cout<<"input h,w";
cin>>h>>w;
x=h-100;
if(w>1.2*x)
cout<<"您的体重超重"<<"建议您适当减肥" ;
else
{
if(w<0.8*x)
cout<<"您的体重超轻"<<"建议您注意饮食";
else
cout<<"您的体重正常,请继续保持";
}
}
三、

#include<iostream>

using namespace std;

int main()

{

cout<<"杨氏银行欢迎您!"<<endl;

cout<<"请输入密码:"<<endl;

int password,num;

cin>>password;

cout<<"1.查询 2.取款 3.存款 4.转账 0.退出"<<endl;

cin>>num;

cout<<"谢谢,您选择了 x 号功能"<<endl;

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: