@MILAN
887 / 781 / 86
Регистрация: 21.02.2009
Сообщений: 1,722
|
23.11.2010, 10:56
|
|
C++ | 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
| #include <iostream>
#include <ctime>
#include <iomanip>
using std::cout;
using std::cin;
using std::endl;
using std::setw;
int main ()
{
srand((unsigned int)time(NULL));
setlocale( LC_ALL,"Russian" );
int size,i,j,jst,count;
int **arr;
cout<<"Введите розмер: ";
cin>>size;
arr = new int*[size];
cout<<"Сформированая матрица:";
cout<<endl;
for(i=0; i<size; i++)
{
arr[i]= new int[size];
for(j=0; j<size; j++)
{
arr[i][j]=rand()%9-1;
cout<<setw(3)<<arr[i][j]<<setw(3);
}
cout<<endl;
}
for(i=0; i<size; i++)
{
count=0;
for(j=0; j<size; j++)
{
if(arr[j][i]==0)
{
count++;
}
}
if(count==1)
{
jst=i;
break;
}
}
cout<<endl<<"Номер первого из столбцов,содержаший один нулевой элемент - "<<jst+1<<endl;
for(i=0;i<size;i++)
delete arr[i];
delete [] arr ;
system("PAUSE");
return 0;
} |
|
0
|