1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
|
#include <iostream>
#include <ctime>
#include <iomanip>
using namespace std;
const int columns = 4;
const int rows = 3;
void Fill_Array (int [][columns] , int , int );
void Copy_Array (int [][columns], int [][rows], int, int);
void Print_A (int [][columns] , int , int );
void Print_B (int [][columns] , int , int );
void Print_Statistics (int [][columns], int, int);
int main() {
int A[rows][columns];
int B[columns][rows];
Fill_Array ( A, rows, columns);
Print_A(A, rows, columns);
Copy_Array (A, B, rows, columns );
Print_B (B, rows, columns);
Print_Statistics(A, rows, columns);
return 0;
}
void Fill_Array (int A[][columns], int rows, int columns)
{
srand(time (0)*2 -1);
for (int i =0; i < 3; i++){
for (int j = 0; j < 4 ; j = j + 2){
A[i][j] = 2*(1 + rand() % 24) + 1;
}
for (int j = 1; j < 4; j = j + 2)
A[i][j] = 2*(1 + rand() % 25) ;
}
}
void Copy_Array (int A[][columns], int B[][rows], int rows, int columns)
{
for (int i = 0; i < 3 ; i++){
for (int j = 0; j < 4; j++){
A[i][j] == B[j][i];
}
}
}
void Print_A (int A[][columns], int rows, int columns)
{
for (int i = 0; i < 3; i++){
for (int j = 0; j < 4; j++){
cout << A[i][j] << " ";
if (j == 3)
cout << endl;
}
}
}
void Print_B (int B[][rows], int rows, int columns)
{
cout << endl;
for (int i = 0; i < 3; i++){
for (int j = 0; j < 4; j++){
cout << B[j][i] << " ";
if (j == 2)
cout << endl;
}
}
}
|