jzphhc @ 2024-10-29 16:52:50
#include<bits/stdc++.h>
using namespace std;
int main(){
int a[3];
char b[3];
for(int i=0;i<3;i++){
cin>>a[i]>>endl;
cin>>b[i]>>endl;
}
sort(a,a+3);
for(int j=0;j<3;j++){
if(b[j]=='A') cout<<a[0];
else if(b[j]=='B') cout<<a[1];
else cout<<a[2];
cout<<endl;
}
return 0;
}
by yitian_ @ 2024-10-29 16:55:28
@jzphhc 你是怎么做到输入换行的 cin>>a[i]>>endl;cin>>b[i]>>endl;
。
#include<bits/stdc++.h>
using namespace std;
int main(){
int a[3];
char b[3];
for(int i=0;i<3;i++){
cin>>a[i];
cin>>b[i];
}
sort(a,a+3);
for(int j=0;j<3;j++){
if(b[j]=='A') cout<<a[0];
else if(b[j]=='B') cout<<a[1];
else cout<<a[2];
cout<<endl;
}
return 0;
}
by fishing_cat @ 2024-10-29 16:55:45
@jzphhc cin>>a[i]>>endl; ????
by _10mbps @ 2024-10-29 16:55:47
啊?谁教你在输入流里放endl换行的啊喂!
cin>>a[i]>>endl改成cin>>a[i]就好了
by _10mbps @ 2024-10-29 16:56:35
@jzphhc 两个都要改一下
by xxsxxsxxs @ 2024-10-29 19:02:25
...6
《cin>>endl》
by C18924990244 @ 2024-11-02 15:14:51
@jzphhc 也要把j循环中的"cout<<endl;"改成"cout<<" ";"