Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
80062 石晋骁 数组中元素交换 C++ Compile Error 0 MS 0 KB 295 2024-07-11 10:54:29

Tests(0/0):


Code:

#include<bits/stdc++.h> using namespace std; int main(){ int n,t; cin >> n; int a[n]; for(int i = 0;i< n;i++){ cin >> a[i]; } for(int j = 0;j< n;j = j+2){ t = a[j]; a[j] = a[j+1]; a[j+1] = t; } for(int k = 0;k< n;k = k++){ cout << a[k]; } return 0; } }


Run Info:

Main.cc: In function 'int main()':
Main.cc:15:26: warning: operation on 'k' may be undefined [-Wsequence-point]
  for(int k = 0;k< n;k = k++){
                          ^
Main.cc: At global scope:
Main.cc:20:1: error: expected declaration before '}' token
 }
 ^