Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- #include <string>
- #include<conio.h>
- #include<cctype>
- using namespace std;
- void main()
- {
- setlocale(LC_ALL, "ukr");
- int mas[5][5], q = 0, w, e, i, j;
- e = 0;
- for (i = 0; i < 5; i++) {
- for (j = 0; j < 4; j++) {
- mas[i][j] = rand() % 50 + 1;
- cout << mas[i][j] << "\t";
- }
- cout << "\n";
- }
- cout << "--------------------------\n";
- for (w = 0; w < 5; w++) {
- for (j = 0; j < 4; j++) {
- for (i = 0; i < 4; i++) {
- if (mas[i][j] > mas[i + 1][j])
- {
- q = mas[i][j];
- mas[i][j] = mas[i + 1][j];
- mas[i + 1][j] = q;
- }
- }
- }
- }
- for (i = 0; i < 5; i++) {
- for (j = 0; j < 4; j++) {
- cout << mas[i][j] << "\t";
- }
- cout << "\n";
- }
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment