Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
105574 | 刘佳宇 | 数组中元素交换 | C++ | Compile Error | 0 MS | 0 KB | 636 | 2025-01-14 09:46:39 |
#include<iostream> using namespace std; int a[10000]; int main(){ int n,c; cin>>n; for( int i=0;i<n;i++){ cin>>a[i]; } for(int j=0;j<n-1;j=j+2){ c=a[j]; a[j]=a[j+1]; a[j+1]=c; } for(int y=0;y<n;y++){ cout<<a[y]<<" "; } return 0; } #include<iostream> using namespace std; int a[10000]; int main(){ int n,c; cin>>n; for( int i=0;i<n;i++){ cin>>a[i]; } for(int j=0;j<n-1;j=j+2){ c=a[j]; a[j]=a[j+1]; a[j+1]=c; } for(int y=0;y<n;y++){ cout<<a[y]<<" "; } return 0; }
Main.cc:21:3: error: stray '#' in program } #include ^ Main.cc:21:4: error: 'include' does not name a type } #include ^ Main.cc:23:12: error: redefinition of 'int a [10000]' int a[10000]; ^ Main.cc:3:5: note: 'int a [10000]' previously declared here int a[10000]; ^ Main.cc: In function 'int main()': Main.cc:24:5: error: redefinition of 'int main()' int main(){ ^ Main.cc:4:5: note: 'int main()' previously defined here int main(){ ^