发表于《C++基本中的基本》
17年1个月前IP:未同步
171541
8楼
LZ写的其实不是C++......那是纯C代码.....
我改成用C++的版本:

#include <iostream>
using namespace std;

int main()
{
    int x, y;
    cout<<"Input your age: "<<endl;
    cin>>x;
    cout<<"Input your brother's age: "<<endl;
    cin>>y;
    if (x<y)
    {
        cout<<"Your age is "<<x<<", your brother's age is "<<y<<"."<<endl;
        cout<<"Your brother is older than you!"<<endl;
    }
    else if (x>y)
    {
        cout<<"You are older than your brother!"<<endl;
    }
    else
    {
        cout<<"Both guys have the same age!"<<endl;
    }
    cout<<"Goodbye!"<<endl;
    return 0;
}
评论
文号 / 171541

百炼成钢
名片发私信
学术分 1
总主题 2 帖总回复 656 楼拥有证书:学者 笔友
注册于 2009/01/18 22:00:19最后登录 2018/01/10 00:50:20
主体类型:个人
所属领域:无
认证方式:邮箱
IP归属地:0

个人简介

暂未填写
笔记
{{note.content}}
{{n.user.username}}
{{fromNow(n.toc)}} {{n.status === noteStatus.disabled ? "已屏蔽" : ""}} {{n.status === noteStatus.unknown ? "正在审核" : ""}} {{n.status === noteStatus.deleted ? '已删除' : ''}}
  • 编辑
  • 删除
  • {{n.status === 'disabled' ? "解除屏蔽" : "屏蔽" }}
我也是有底线的