#include <fstream>
#include <iostream>
#include <string>
using namespace std;
int filess() {
int a[25]={0};
ofstream file("proertyy.txt");
for (int i = 0; i < 25; i++)
{
a[i] = rand() % 10 + 1;
file << a[i];
}
return 0;
}
int main()
{
filess();
setlocale(LC_ALL, "Russian");
ifstream readfile("proertyy.txt", ios::in | ios::binary);
const int strings = 25;
char mass[strings]={0};
if (!readfile.is_open()) {
cout << "Файл не открыт"<<endl;
}
else {
cout << "Файл открыт"<<endl;
}
for (int i = 0; i < strings; i++)
{
readfile >> mass[i];
cout <<mass[i] << endl;
}
int buff = 0;
int i, j;
for (i = 1; i < strings; i++)
{
buff = mass[i];
for (j = i - 1; j >= 0 && mass[j] > buff; j--)
mass[j + 1] = mass[j];
mass[j + 1] = buff;
}
ofstream file("proertyy.txt");
for (int i = 0; i < strings; i++) {
cout << mass[i];
int a = mass[i];
file << a;
}
readfile.close();
return 0;
}