Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
149550 谭思宸 打印每一趟选择排序 C++ Compile Error 0 MS 0 KB 576 2026-03-14 11:35:40

Tests(0/0):


Code:

#include<bits/stdc++.h> using namespace std; intmain() { int n; cin >> n; inta[n]; for (int i = 0; i < n; i++) { cin >> a[i]; } int Min, t; for (int j = 0; j <= n - 2; j++) { Min = j; for (int i = j + 1; i <= n - 1; i++) { if (a[i] < a[Min]) { Min = i; } } t = a[j]; a[j] = a[Min]; a[Min] = t; for (int i = 0; i <= n - 1; i++) { cout << a[i] << " "; } cout << endl; } return 0; }


Run Info:

Main.cc:3:9: error: ISO C++ forbids declaration of 'intmain' with no type [-fpermissive]
 intmain() {
         ^
Main.cc: In function 'int intmain()':
Main.cc:6:5: error: 'inta' was not declared in this scope
     inta[n]; 
     ^
Main.cc:8:16: error: 'a' was not declared in this scope
         cin >> a[i]; }
                ^
Main.cc:13:17: error: 'a' was not declared in this scope
             if (a[i] < a[Min]) {
                 ^
Main.cc:17:13: error: 'a' was not declared in this scope
         t = a[j]; 
             ^