wvvvvvvvvvvvv @ 2024-03-24 08:20:24
#include<stdio.h>
int main()
{
int a,b,c,d,i;
char order[3];
scanf("%d %d %d",&a,&b,&c);
if (a>b)
{
d=b;
b=a;
a=d;
}
if(b>c)
{
d=b;
b=c;
c=d;
}
if(a>c)
{
d=a;
a=c;
c=d;
}
scanf("%s",order);
for(i=0;i<3;i++)
{
switch(order[i])
{
case 'A':
printf("%d ",a);
break;
case 'B':
printf("%d ",b);
break;
case 'C':
printf("%d ",c);
break;
}
}
return 0;
}
by light_searcher @ 2024-03-24 08:30:11
应该是排序有问题,比较抽象
by wmz_lost @ 2024-03-24 08:31:51
@wvvvvvvvvvvvv 您这个发一下是哪道题啊, 看不了亿点啊。
by wenlebo @ 2024-03-24 08:31:55
基础不扎实导致的,排序要多进行几遍才行,还有就是定义变量要么给他个初始值要么把它放到外面(初始值自动为0)
by wvvvvvvvvvvvv @ 2024-03-24 09:03:55
@light_searcher 确实是比较抽象哈哈哈哈
by wvvvvvvvvvvvv @ 2024-03-24 09:04:27
@wenlebo 好的好的 感谢感谢
by baisedeyun @ 2024-03-31 09:31:03
我也和你一样的思路,代码都差不多,也是一直不过,您现在过了吗
by baisedeyun @ 2024-03-31 09:31:56
一直不知道错在哪里?
by Windy0430 @ 2024-04-21 17:55:58
using namespace std;
int a , b , c , a1 , b1 , c1 , d;
char A , B , C;
int main(){
cin >> a >> b >> c ;
if (a > b){
d = b;
b = a;
a = d;
}
if (b > c){
d = c;
c = b;
b = d;
}
if (a > b){
d = b;
b = a;
a = d;
}
cin >> A >> B >> C;
if (A == 'A'){
cout << a << " ";
}
if (A == 'B'){
cout << b << " ";
}
if (A == 'C'){
cout << c << " ";
}
if (B == 'A'){
cout << a << " ";
}
if (B == 'B'){
cout << b << " ";
}
if (B == 'C'){
cout << c << " ";
}
if (C == 'A'){
cout << a << " ";
}
if (C == 'B'){
cout << b << " ";
}
if (C == 'C'){
cout << c << " ";
}
return 0;
}