Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
135911 薛轶凡 【一维数组】数组元素移动(1) C++ Compile Error 0 MS 0 KB 369 2025-11-08 17:20:50

Tests(0/0):


Code:

#include<iostream> using namespace std; int main(){ int n; cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; } int temp = a[n - 1]; for (int i = n - 1; i > 0; i--) { a[i] = a[i - 1]; } a[0] = temp; cout << a[0]; for (int i = 1; i < n; i++) { cout << " " << a[i]; } return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:7:16: error: 'a' was not declared in this scope
         cin >> a[i];
                ^
Main.cc:9:16: error: 'a' was not declared in this scope
     int temp = a[n - 1];
                ^