Heim > Fragen und Antworten > Hauptteil
#include "iostream"
using namespace std;
int main() {
int arr[1000];
int j = 0;
std::cin >> j;
for (size_t i = 0; i < j; i++) {
std::cin >> arr[i];
}
for (size_t i = 0; i < j; i++) {
for (size_t m = 0; m < j; m++) {
if (arr[i] < arr[m]) {
int a = arr[m];
arr[m] = arr[i];
arr[i] = a;
}
}
}
for (size_t i = 0; i < j; i++) {
std::cout << arr[i] << endl;
}
std::cout << '\n' << endl;
return 0;
}
liner-gcc报错了:
自己琢磨可能是哪里写的不规范,求指点