Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
157068 张浩然 书的价格 C++ Compile Error 0 MS 0 KB 419 2026-07-13 14:44:23

Tests(0/0):


Code:

#include<bits/stdc++.h> using namespace std; struct book{ string name; double jg; }; bool cmp(book a,book b){ if(a.jg>b.jg){ return 1; }else{ return 0; } } int main(){ int n; cin>>n; student x[n]; for(int i=0;i<n;i++){ getline(cin,x[i].name); cin>>x[i].jg; } sort(x+0,x+n,cmp); for(int i=0;i<n;i++){ print("%2.f,%s",x[i].jg,x[i].name); cout<<<<endl; } return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:17:2: error: 'student' was not declared in this scope
  student x[n];
  ^
Main.cc:19:15: error: 'x' was not declared in this scope
   getline(cin,x[i].name);
               ^
Main.cc:22:7: error: 'x' was not declared in this scope
  sort(x+0,x+n,cmp);
       ^
Main.cc:24:38: error: 'print' was not declared in this scope
   print("%2.f,%s",x[i].jg,x[i].name);
                                      ^
Main.cc:25:9: error: expected primary-expression before '<<' token
   cout<<<