#include <iostream>//先锋头文件 #include <algorithm> using namespace std; class student//主体军队 { public: void shu() { cin >> x >> c; } int chu1() { return x; } int chu2() { return c; } void chu() { cout << x << " "; cout << c << "\n"; } private: int x;//学号 int c;//成绩 }; int main()//总指挥部 { int s1,s2,s; cin >> s1 >> s2; s=s1+s2; student r[s]; int xue[s]; for(int i=0;i<s;i++) { r[i].shu(); xue[i]=r[i].chu1(); } sort(xue,xue+s); for(int j=0;j<s;j++) { for(int i=0;i<s;i++) { if(r[i].chu1()==xue[j]) { r[i].chu(); goto Z;//偷偷来到军队的goto语句 } } Z:; } return 0; }
很简单的代码,为QAQ点个赞吧!
0.0分
1 人评分
DNA (C语言代码)浏览:540 |
C语言程序设计教程(第三版)课后习题5.5 (C语言代码)浏览:553 |
输出九九乘法表 (C语言代码)浏览:1048 |
陶陶摘苹果2 (C语言代码)浏览:595 |
简单的a+b (C语言代码)浏览:506 |
找出最长的字符串来 (C语言代码)浏览:1760 |
C语言程序设计教程(第三版)课后习题8.1 (C语言代码)浏览:713 |
C二级辅导-公约公倍 (C语言代码)浏览:1309 |
C二级辅导-等差数列 (C语言代码)浏览:770 |
孤独的骑士 (C语言代码)浏览:1043 |