输出问题,输入三个数,从小到大排序,中间隔空不要换行,我这是哪里错了呀

发布时间:2019-09-21 00:15:08
贴主:林老熊
热度:3

林老熊 2019-09-21

#include <iostream>;

using namespace std;

int main()

{

int a, b, c;

cin >> a >> b >> c;

if (a > b&&a > c&&b > c)

{

cout << c << " " << b << " " << a;

}

else if (a > b&&a > c&&c > b)

{

cout << b << " " << c << " " << a;

}

else if (b > a&&b > c&&a > c)

{

cout << c << " " << a << " " << b;

}

else if (b > a&&b > c&&c > a)

{

cout << a << " " << c << " " << b;

}

else if (c > a&&c > b&&a > b)

{

cout << b << " " << a << " " << c;

}

else

{

cout << a << " " << b << " " << c;}}


(0)

龙门近卫局陈sir 2019-09-21

首先,头文件后面不用加分号;

然后关于为什么错:你没考虑等于的情况,比如输入个5 1 1, 输出就错了。

(1)

Copyright 2016 - 2024 XUJC ACM Team
闽ICP备2020022076号-1