Академический Документы
Профессиональный Документы
Культура Документы
if (j==m) {
cout<<" ]"<<endl;
i++;
j=0;
if (i<n ) {
cout<<"[ ";
}
if (i>n/2) {
c--;
}else{
c++;
}
}
if (i==m)
return;
else{
if(j>(n/2) ) {
cout<<" 0";
mat4(mat,n,m,i,j+1,c);
} else{
if (j>c )
cout<<" ";
else
cout<<j+i;
mat4(mat,n,m,i,j+1,c);
}
}
}
0 000
12 000
234 000
3456000
456 000
56 000
6 000
////////////////////////////////////////////////////////////////////////////////
////////
///////////////////////////////////////////////////////////////////////////
void mat5(int mat[50][50],int n,int m,int i,int j,int c,int h){
if (j==m) {
cout<<" ]"<<endl;
i++;
j=0;
h=1;
if (i<n) {
cout<<"[ ";
}
if (i>(n/2)) {
c=c-1;
}else{
c=c+1;
}
}
if (i==n)
return;
else{
if (j<(n/2) ){
cout<<" 0";
mat5(mat,n,m,i,j+1,c , h +1);
}else{
if (j<((m - c) -1))
cout<<" ";
else
cout<<i;
mat5(mat,n,m,i,j+1,c,h+1);
}
}
}
000 0
000 11
000 222
0003333
000 444
000 55
000 6
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
//////////////////////////7/////
void mat3(int mat[50][50],int n,int m,int i,int j){
if (j==m) {
cout<<" ]"<<endl;
i++;
j=0;
if (i<m){
cout<<"[ ";
}
}
if (i==m)
return;
else{
if ((i<(n/2) )) {
cout<<"0";
mat3(mat,n,m,i,j+1);
}else{
if (((j> i)&&(j<=m+i))&&(j>=((n/2) + 1) ))
cout<<" ";
else
cout<<j;
mat3(mat,n,m,i,j+1);
}
}
}
0000000
0000000
0000000
0123
01234
012345
0123456