Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
85151 揭伟琦 打印每一趟插入排序 C++ Compile Error 0 MS 0 KB 802 2024-07-16 16:40:32

Tests(0/0):


Code:

#include<iostream> using namespace std; int a[2001]; int main(){ int n,t; cin>>n;# include<iostream> using namespace std; int a[2001]; int main(){ int n,t; cin>>n; for(int i=0;i<n;i++){ cin >>a[i]; } for(int i=0;i<n;i++){ for(int j=0;j<n-i-1;j++){ if(a[j]>a[j+1]){ t=a[j]; a[j]=a[j+1]; a[j+1]=t; } } for(int k=0;k<n;k++){ cout <<a[k]<<' '; } cout <<endl; } return 0; } for(int i=0;i<n;i++){ cin >>a[i]; } for(int i=0;i<n-1;i++){ for(int j=0;j<n-1-i;j++){ if(a[j]>a[j+1]){ t=a[j]; a[j]=a[j+1]; a[j+1]=t; } } for(int k=0;k<n;k++){ cout <<a[k]<<' '; } cout <<endl; } return 0; }


Run Info:

Main.cc:6:8: error: stray '#' in program
 cin>>n;# include 
        ^
Main.cc: In function 'int main()':
Main.cc:6:10: error: 'include' was not declared in this scope
 cin>>n;# include 
          ^
Main.cc:6:26: error: expected primary-expression before '>' token
 cin>>n;# include 
                          ^
Main.cc:7:1: error: expected primary-expression before 'using'
 using namespace std;
 ^
Main.cc:9:11: error: a function-definition is not allowed here before '{' token
 int main(){
           ^
Main.cc:5:7: warning: unused variable 't' [-Wunused-variable]
 int n,t;
       ^
Main.cc:8:5: warning: unused variable 'a' [-Wunused-variable]
 int a[2001];
     ^
Main.cc:50:1: error: expected '}' at end of input
 }
 ^