srand(time(0));
const int size = 9;
int A[size]{};
cout << "Massive A:" << endl;
for (int i = 0; i < size; i++) {
}
cout << endl;
int tmp;
for (int i = 0, j = 0; i < size; i++) {
}
cout << endl << "Sort massive:" << endl;
for (int i = 0; i < size; i++)
cout << endl << endl;
cout << "Mediana: " << A[size / 2 + 1] << endl;
system("pause");
const int size = 9;
int A[size]{};
cout << "Massive A:" << endl;
for (int i = 0; i < size; i++) {
A[i] = rand() % 51;
cout << A[i] << "\t";
}
cout << endl;
int tmp;
for (int i = 0, j = 0; i < size; i++) {
tmp = A[i];
for (j = i - 1; j >= 0 && A[j] > tmp; j--) {
A[j + 1] = A[j];}
A[j + 1] = tmp;
}
cout << endl << "Sort massive:" << endl;
for (int i = 0; i < size; i++)
cout << A[i] << "\t";
cout << endl << endl;
cout << "Mediana: " << A[size / 2 + 1] << endl;
system("pause");
Комментариев нет:
Отправить комментарий