Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
93974 石依灵 成绩排序 C++ Compile Error 0 MS 0 KB 412 2024-10-19 16:46:43

Tests(0/0):


Code:

#include<iostream> using namespace std; struct student{ string name; int a; } student stu[10]; int main(){ for(int i=0;i<10;i++){ cin>>stu[i].name; cin>>stu[i].a; } for(int i=0;i<9;i++){ for(int j=0;j<9-i;j++){ if(stu[j].a<stu[j+1].a){ swap(stu[j],stu[j+1]); } } } return 0; }


Run Info:

Main.cc:7:9: error: expected initializer before 'stu'
 student stu[10];
         ^
Main.cc: In function 'int main()':
Main.cc:10:14: error: 'stu' was not declared in this scope
         cin>>stu[i].name;
              ^
Main.cc:15:16: error: 'stu' was not declared in this scope
             if(stu[j].a