Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
61002 孙诗皓 成绩排序 C++ Compile Error 0 MS 0 KB 865 2023-11-25 16:36:13

Tests(0/0):


Code:

#include<iostream> #include<iomanip> using namespace std; typedef struct Strdent { int age; char str[21]; }Student_s; bool scmp(Student_s stua,Student_s stub) { if(stua.age<stub.age) return true; else if(stua.age==stub.age) { if(strcmp(stua.str,stub.str)) return true; else return false; } else return false; } int main(){ int n,i,j; Student_s stu[21]={0}; cin>>n; for(int i=0;i<n;i++){ cin>>stu[i].str; cin>>stu[i].age; } for(i=0;i<n-1;i++) { for(j=0;j<n-1-i;j++) { if(scmp(stu[j],stu[i+1])) swap(stu[j],stu[i+1]); } } for(int i=0;i<n;i++) { cout<<stu[i].str<<" "; cout<<stu[i].age<<endl; } return 0; }


Run Info:

Main.cc: In function 'bool scmp(Student_s, Student_s)':
Main.cc:15:36: error: 'strcmp' was not declared in this scope
         if(strcmp(stua.str,stub.str))
                                    ^
Main.cc:22:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^