Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
84818 杜奕辰 选择排序 C++ Compile Error 0 MS 0 KB 491 2024-07-16 14:42:46

Tests(0/0):


Code:

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


Run Info:

Main.cc: In function 'int main()':
Main.cc:15:17: error: 'k' was not declared in this scope
                 k=j;
                 ^