const int size = 10;
int A[size]{};
int tmp;
for (int i = 0; i < size; i++) {
}
cout << "Massive A:" << endl;
for (int i = 0; i < size; i++) {
}
cout << endl;
for (int i = 0, j = 0; i < size; i++) {
}
cout << endl << "Sort massive:" << endl;
for (int i = 0; i < size; i++)
cout << endl;
system("pause");
int A[size]{};
int tmp;
for (int i = 0; i < size; i++) {
cout << "Enter A[" << i << "]:";
cin >> A[i];
}
cout << "Massive A:" << endl;
for (int i = 0; i < size; i++) {
cout << A[i] << "\t";
}
cout << endl;
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;
system("pause");
Комментариев нет:
Отправить комментарий