.


:




:

































 

 

 

 





I. . .

) :

int A[n][m]= {{1, -2, 3, -4, 5},

{ 10, 20, 33, -40},

{-11, 22, 300, 400, 500}};

, , . 1 ( , ) .

) , , , . , ( ) . . :

for (i=0; i<n; i++)

for (j=0; j<m; j++)

cin>>A[i][j];

, , . , , ,

. , , :

for (y=wherey(), i=0; i<n; i++, y++)

{ gotoxy(1, y); cout<<"i="<<i;

for (x=5, j=0; j<m; j++, x+=5)

{ gotoxy(x,y);

cin>>A[i][j];

} }

) , ,

Randomize();

for (i=0; i<n; i++)

for (j=0; j<m; j++)

A[i][j]=random(100);

, [r1, r2), r2>r1, A[i][j]=random(r2-r1)+r1; , .

) (), :

for (i=0; i<n; i++)

for (j=0; j<m; j++)

A[i][j]=(i+1)*(j+1);

.

. , . , .

II. .

) , for , ..

:

cout<<\n;

for (i=0; i<n; i++)

{ printf("\n"); // .

for (j=0; j<m; j++)

printf ("%5d", A[i][j]);

}

%5d, . . . , , , %7.2f. printf("\n"). \n (printf ("\n%5d", A[i][j])), . .

. , C1 C2, , 2 1, 1 2 , . , , :

void MyColors (int C1, int C2)//

{ textcolor(C1);

textbackground(C2); }

void main()

{ textbackground(3); clrscr(); //

const n=4,m=6; float A[n][m];

//

//

randomize();

for (int i=0; i<n; i++)

for (int j=0; j<m; j++)

A[i][j]=(random(50)-40)/100. + random(5);

for (int i=0; i<n; i++)

{ cout<<endl; // .

for (int j=0; j<m; j++)

{ if (A[i][j]>0) MyColors(2,15); //

else MyColors(15,2);

cprintf ("%7.2f", A[i][j]);

}

} getch();

}





:


: 2016-10-06; !; : 338 |


:

:

, , .
==> ...

1378 - | 1289 -


© 2015-2024 lektsii.org - -

: 0.01 .