- /*
- * 文件名称:exdd.cpp
- * 作 者:陈翰丰
- * 完成日期:2016 年 4月4日
- * 版 本 号:v1.0
- * 对任务及求解方法的描述部分: 编程序
- * 输入描述:
- * 问题描述:
- * 程序输出:
- * 问题分析:略
- * 算法设计:略
- *
-
-
/#include <iostream>
using namespace std;
int main()
{
double height,weight,standard;
cout<<"输入身高和体重:";
cin>>height>>weight;
standard=height-100;
cout<<standard;
if(weight>1.2*standard)
cout<<"超重"<<endl;
else if(weight<0.8*standard)
cout<<"超轻"<<endl;
else
cout<<"正常"<<endl;
return 0;
}
-
-
-
#include <iostream>
using namespace std;
int main()
{
int x,y;
cout<<"输入x";
cin>>x;
if(x>=1)
{
y=x-1;
cout<<y;
}
else
y=1-x;
cout<<y<<endl;
return 0;
}
-
-
#include <cmath>
#include<iostream>
using namespace std;
int main()
{
double x1,y1,x2,y2,L;
cout<<"输入两点的坐标"<<endl;
cin>>x1>>y1>>x2>>y2;
L=sqrt((y2 - y1)*(y2 - y1) + (x2 - x1)*(x2 - x1));
cout<<"距离="<<L<<endl;
return 0;
}
-
-
-
#include <iostream>
using namespace std;
int main()
{
int password,a;
cout<< "陈氏银行欢迎您" << endl;
cout<<"请输入密码:"<<endl;
cin>>password;
if(password==546421)
{
cout<<"密码正确"<<endl;
cout<<"1.查询\n2.取款\n3.存款\n4.转账\n0.退出"<<endl;
cin>>a;
if(a==1)
cout<<"谢谢,您选择了1号功能";
else if(a==2)
cout<<"谢谢,您选择了2号功能";
else if(a==3)
cout<<"谢谢,您选择了3号功能";
else if(a==4)
cout<<"谢谢,您选择了4号功能";
else if(a==0)
cout<<"谢谢,您选择了0号功能";
}
else
cout<<"密码错误"<<endl;
return 0;
}
C++作业2
最新推荐文章于 2024-12-09 22:09:58 发布