c++第二次作业

<pre name="code" class="cpp">#include<iostream>  
using namespace std;  
int main()  
{  
     int x,y;  
     cout<<"输入x的值:";  
     cin>>x;  
     if(x>=1)  
         cout<<"y="<<x-1<<endl;  
     else  
         cout<<"y="<<-x+1<<endl;  
     return 0;  
} 

 #include<cmath>  
#include<iostream>  
  
using namespace std;  
int main()  
{  
    double x1,y1,x2,y2;  
    cout<<"输入第一个点的坐标:";  
    cout<<"x1=";  
    cin>>x1;  
    cout<<"y1=";  
    cin>>y1;  
        cout<<"输入第二个点的坐标:";  
    cout<<"x2=";  
    cin>>x2;  
    cout<<"y2=";  
    cin>>y2;  
    cout<<"两点间的距离:"<<sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2))<<endl;  
    return 0;  
}  

#include<iostream>  
using namespace std;  
int main()  
{  
    int m=199704,m1,x;  
    cout<<"刘氏银行欢迎你!"<<endl;  
    cout<<"请输入密码:";  
    cin>>m1;  
    if(m1==m)  
    {  
        cout<<"密码正确"<<endl;  
        cout<<"请选择操作内容:1.查询2.取款3.存款4.转帐0.退出"<<endl;  
        cin>>x;  
        if(x==1)  
            cout<<"谢谢,您选择了1号功能"<<endl;  
        else if(x==2)  
            cout<<"谢谢,您选择了2号功能"<<endl;  
        else if(x==3)  
            cout<<"谢谢,您选择了3号功能"<<endl;  
        else if(x==4)  
            cout<<"谢谢,您选择了4号功能"<<endl;  
        else if(x==0)  
            cout<<"谢谢,您选择了0号功能"<<endl;  
    }  
    if(m1!=m)  
        cout<<"对不起,密码错误,请重新输入"<<endl;  
    return 0;  
}


 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值