Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
133370 罗迎甲 朋友信息 C++ Compile Error 0 MS 0 KB 731 2025-10-18 16:15:29

Tests(0/0):


Code:

#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; strunt fd{ string nama; int birth; string n1; }f[20]; bool cmp(fd x,fd y){ if(x.birth!=y.birth) return x.birth<y.birth; else if(x.nama!=y.nama) return x.nama<y.nama; else return x.n1<y.n1; } int main(){ int n; cin>>n; for(int i=0;i<n;i++) cin>>f[i].nama>>f[i].birth>>f[i].n1; sort(f+0,f+n,cmp); for(int i=0;i<n;i++) cout<<f[i].nama<<f[i].birth<<f[i].n1<<endl; return 0; }


Run Info:

Main.cc:7:1: error: 'strunt' does not name a type
 strunt fd{
 ^
Main.cc:11:2: error: 'f' does not name a type
 }f[20];
  ^
Main.cc:12:10: error: 'fd' was not declared in this scope
 bool cmp(fd x,fd y){
          ^
Main.cc:12:15: error: 'fd' was not declared in this scope
 bool cmp(fd x,fd y){
               ^
Main.cc:12:19: error: expression list treated as compound expression in initializer [-fpermissive]
 bool cmp(fd x,fd y){
                   ^
Main.cc:12:20: error: expected ',' or ';' before '{' token
 bool cmp(fd x,fd y){
                    ^
Main.cc: In function 'int main()':
Main.cc:26:10: error: 'f' was not declared in this scope
     cin>>f[i].nama>>f[i].birth>>f[i].n1;
          ^
Main.cc:27:10: error: 'f' was not declared in this scope
     sort(f+0,f+n,cmp);
          ^
Main.cc:27:21: error: 'sort' was not declared in this scope
     sort(f+0,f+n,cmp);
                     ^