#include <iostream>
#include <ctime>
#include <cmath>
using namespace std;
int main()
{
srand(time(NULL));
setlocale(LC_ALL, "ru");
//Creation
int row = 6;
int cols = 3;
int **mass = new int* [row];
for (int i = 0; i < row; i++)
{
mass[i] = new int[cols];
}
//Generating element value
for (int i = 0; i < row; i++)
{
for (int j = 0; j < cols; j++)
{
mass[i][j] = rand()%20;
cout << mass[i][j] << "\t";
}
cout << endl;
}
//checking for element multiple 7!!!A!!!
for (int i = 0; i < row; i++)
{
for (int j = 0; j < cols; j++)
{
if (mass[i][j]%7==0)
{
cout<<"element with coord ("<<i<<"; "<<j<<") is multiple 7th"<<endl;
}
}
}
//Finding last element wich biggest then Z !!!B!!!
int z;
cout<<"Input a number"<<endl;
cin>>z;
bool f = true;
for (int i = row; i > 0; i--)
{
for (int j = cols; j > 0; j--)
{
f = true;
if (mass[i][j]>z)
{
cout<<"The last number wich biggest then "<<z<<" have coord ("<<i<<" "<<j<<")"<<endl;
break;
}
else
{
f = false;
}
}
if (f == true)
{
break;
}
}
//Finding first element = 0 !!!C!!!
for (int i = 0; i < row; i++)
{
for (int j = 0; j < cols; j++)
{
if (mass[i][j]==0)
{
cout<<"element with coord ("<<i<<" "<<j<<") = 0"<<endl;
}
}
}
//Finding last element %7=0 and %2=0 !!!D!!!
for (int i = 0; i < row; i++)
{
for (int j = 0; j < cols; j++)
{
if (mass[i][j]%7==0)
{
if (mass[i][j]%2==0)
{
cout<<"element with coord ("<<i<<" "<<j<<") is multiple 7th and two"<<endl;
}
}
}
}
//Deleting
for (int i = 0; i < row; i++)
{
delete[] mass[i];
}
delete[] mass;
system("PAUSE");
return 0;
}