

循环三次,本应输出三个结果,但只输出了两个。而且没有进行算术运算,输出结果和预期不符
你的问题主要出在scanf中%d与%c混合输入时,%c会接收到回车
解决很简单,用%s就没有问题了
另外,注意你输出间要加空格的
改好的
#include <stdio.h>
int main()
{
int i, a, b, c, t;
char str[4];
scanf("%d%d%d", &a, &b, &c);
scanf("%s", str);
if (a > b)
{
t = a;
a = b;
b = t;
}
if (a > c)
{
t = a;
a = c;
c = t;
}
if (b > c)
{
t = b;
b = c;
c = t;
}
for (i = 0; i < 3; i++)
{
if (str[i] == 'A')
printf("%d ", a);
if (str[i] == 'B')
printf("%d ", b);
if (str[i] == 'C')
printf("%d ", c);
}
return 0;
}