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

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; book x[n]; for(int i=0;i<n;i++){ getline(cin,x[i].name); cin>>x[i].jg; } sort(x+0,x+n,cmp); printf("%.2f, ",x[0].jg); cout<<x[i].name<<endl; printf("%.2f, ",x[n-1].jg); cout<<x[n-1].name<<endl; return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:24:10: error: 'i' was not declared in this scope
  cout<