鱼C论坛

 找回密码
 立即注册
查看: 837|回复: 2

[已解决]求大佬帮我看看

[复制链接]
发表于 2021-2-2 01:57:03 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
本帖最后由 英俊男孩建坤 于 2021-2-2 02:17 编辑
  1. #include<iostream>

  2. using namespace std;

  3. int main(){
  4.     int a ,b ,c,sum;

  5.     cout <<"Enter three different integers:";
  6.     cin >> a>> b>> c;
  7.     sum = a+ b+ c;
  8.     cout << "Sum is: "<< sum<< endl;
  9.     cout <<"Average is: "<< sum /3<< endl;
  10.     cout <<"Product is: "<< a*b*c<< endl;

  11.     if (a>b>c){
  12.         cout <<"The largest number is: "<< a<< endl;
  13.         cout <<"The smallest number is: "<< c<< endl;
  14.     }else if (a>c>b){
  15.         cout <<"The largest number is: "<< a<< endl;
  16.         cout <<"The smallest number is: "<< b<< endl;
  17.     }else if (b>a>c){
  18.          cout <<"The largest number is: "<< b<< endl;
  19.          cout <<"The smallest number is: "<< c<< endl;
  20.     }else if (b>c>a){
  21.         cout <<"The largest number is: "<< b<< endl;
  22.         cout <<"The smallest number is: "<< a<< endl;
  23.     }else if(c>a>b){
  24.         cout <<"The largest number is: "<< c<< endl;
  25.         cout <<"The smallest number is: "<< b<< endl;
  26.     }else{
  27.         cout <<"The largest number is: "<< c<< endl;
  28.         cout <<"The smallest number is: "<< a<< endl;
  29.     }
  30.    
  31.     return 0;
  32. }
复制代码



为什么最后比较三个数字的大小部分不能正常运行  我无论如何输入数字就只会执行最后的else部分语句  并不会进行比较
最佳答案
2021-2-2 06:57:02
a>b>c这种语法有些想当然了,电脑不能识别
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2021-2-2 06:57:02 From FishC Mobile | 显示全部楼层    本楼为最佳答案   
a>b>c这种语法有些想当然了,电脑不能识别
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 1 反对 0

使用道具 举报

发表于 2021-2-2 10:36:51 From FishC Mobile | 显示全部楼层
wp231957 发表于 2021-2-2 06:57
a>b>c这种语法有些想当然了,电脑不能识别

没错,没这样的语法的
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-5-2 04:28

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表