竞赛讨论区 > 为什么使用多个elseif语句却根本没有输出结果
头像
焦虑是自由引起的眩晕
发布于 2021-12-15 19:38
+ 关注

为什么使用多个elseif语句却根本没有输出结果

代码如下  求解答

#include <iostream>
using namespace std;
int main()
{
    int a,b,c;
    cin >> a,b,c;
    if(a>=b&&a>=c){
        cout<<"The maximum number is : "<<a<<endl;
    }
    else if(c>b&&c>a){
        cout<<"The maximum number is : "<<c<<endl;
    }  
    else if(b>a&&b>c){
        cout<<"The maximum number is : "<<b<<endl;
    }
    else if(a>b&&c>b){
        cout<<"The minimum number is : "<<b<<endl;
    }
    else if(b>a&&c>a){
        cout<<"The minimum number is : "<<a<<endl;
    }
    else if(b>c&&a>c){
        cout<<"The minium number is : "<<c<<endl;
    }
    return 0;
}

全部评论

(0) 回帖
加载中...
话题 回帖

本文相关内容

等你来战

查看全部

热门推荐