// ConsoleApplication1.cpp: определяет точку входа для консольного приложения.
//
#include "stdafx.h"
#include <iostream>
#include <stdio.h>
#include <cstdlib>
using namespace std;
#include <conio.h>
int main()
{
int** matrix = new int*[10];
for (int i = 0; i < 10; i++)
matrix[i] = new int[10];
for (int i = 0; i < 10; i++)
for (int j = 0; j < 10; j++)
matrix[i][j] = rand() % 9;
for (int i = 0; i < 10; i++) {
for (int j = 0; j < 10; j++) {
cout << matrix[i][j] << " ";
}
cout << endl;
}
int *mass = new int[100];
int x = 0;
int j = 0;
int i = 9;
int point = 0;
for (; i > 0; i--) {
point = i;
mass[x] = matrix[i][j];
x++;
while (point < 9) {
point++;
for (j = 1; j < 10; j++) {
mass[x] = matrix[point][j];
x++;
if(point == 9)
j = 10;
point++;
}
}
j = 0;
}
cout << endl;
int s = 0;
for (int p = 0; p < 100; p++) {
cout << mass[p] << " ";
s++;
if (s == 10) {
s = 0;
cout << endl;
}
}
getchar();
return 0;
}
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.