There was a question, I read the array from the file and sort it like this:
ifstream file("input.txt"); if (!file.is_open()) cout << "Файл не может быть открыт!"<<endl; else { int n, count = 0; while (file >> n) ++count; file.clear(); file.seekg(0, ios::beg); int * data = new int[count]; int * sort_data = new int[count]; count = 0; while (file >> n) data[count++] = n; cout << "Массив из файла:" << endl; for (int i = 0; i < count; i++) cout << data[i] << ' '; cout << endl; //////////////////////////////////// sort_mass(data, count); //////////////////////////////////// cout << "Отсортированный массив значений: " << endl; for (int i = 0; i < count; i++) cout << data[i] << " "; cout << endl; How to check for third-party characters, so that if it is in the file, something is not in this form: -3 15 5 10 16, issue a read error message or select the numbers from the recorded one and write them into an array