.


:




:

































 

 

 

 





, . , .

(,...), , . , , , , .

(...) . , .

, .

, . const. Const , .

(inline)

, ( ). inline , .

 

 

4:

/* poisk , , n_max . n_max */

int poisk(int* a, int n, int* n_max)

// a -

// n -

//

{

int amax, i;

 

//

// ! *n_max - , n_max

=a[0]; *n_max = 0;

 

for(i = 1; i < n; i++) //

if ( <a[i]) //

{

= a[i]; //

*n_max = i; // ! *n_max

}

return amax; //

}

 

5:

/* poisk , , n_max . n_max */

int poisk(int* a, int n, int& n_max)

// a -

// n -

//

{

int amax, i;

 

//

// ! n_max

=a[0]; n_max = 0;

 

for(i = 1; i < n; i++) //

if ( <a[i]) //

{

= a[i]; //

n_max = i; // ! n_max

}

return amax; //

}

 

6:

/* */

int GetSize() //

{

int n; //

cout<<" n \n"; // n

cin>>n; // n

return n; //

}

 

 

7:

/* */

 

void GetArray(int* a, int n) //

// a ,

// n-

{

cout<<" \n"; // a

for(int i = 0; i < n; i++) cin>>a[i]; // a

}

 

8:

/* */

 

void put_array(int a[10], int n)

{

cout<<" \n";

for(int i = 0; i < n; i++) cout<<" "<<a[i];

cout<<"\n";

}

void put_array(int a[], int n)

{

cout<<" \n";

for(int i = 0; i < n; i++) cout<<" "<<a[i];

cout<<"\n";

}

void put_array(int* a, int n)

{

cout<<" \n";

for(int i = 0; i < n; i++) cout<<" "<<a[i];

cout<<"\n";

}

 

9:

/* */

 

void main()

{

int a[10], n, //

number_max, maximum; // ,

 

n = GetSize(); // /

 

// get_array

//

get_array(a, n);

 

// put_array

//

put_array(a, n);

 

 

// poisk

//

maximum = poisk(a, n, &number_max);

 

//

cout<<" = "<<maximum<<

" = "<<number_max<<"\n";

}

 

, ()

 

 

double mySum(double fMyMatr[MaxRows][MaxCol]);   double fSum; double Fmatrix1[10][10]; ... fSum = mySum(Fmatrix1); mySum - , MaxRows MaxCol . , , , .  
double TheirSum (double FTheirMatr [ MaxRows2 ][MaxCol ], int nNumRows = MaxRows1, int nNumCols = MaxCols);     const MaxRows1 = 10; const MaxRows2 = 10; const MaxCols = 20;   double fSum; double Fmatrix2[10][20]; ... fSum = TheirSum(Fmatrix2); ... fSum = TheirSum(Fmatrix2,5,5); TheirSum . , MaxRows MaxCol . nColRows nNumCols , .  
double yourSum(double fYourMatr[ ][MaxCol], int nColRows, int nNumCols);     yourSum fYourMatr, double . nColRows nNumCols , . nNumRows fYourMat.  

 

 

10:

/* m */

void print_m34 (int m[3][4])

{

int i, j;

for (i = 0; i < 3; i++)//

{

for (j = 0; j < 4; j++)//

cout<< "<<m [i][j];//

cout<<"\n";//

}

}

 

, .

, . , :

11:

/* m dim 4- */

 

void print_m34 (int m[][4], int dim)

{

int i, j;

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

{

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

out<< << m [i][j];

cout<<"\n";

}

}

, :

void print_m34 (int m[][], int dim1, int dim2); .

:

12:

/* , m dim1 dim2 */

 

void print_m34 (int **m, int dim1, int dim2)

{

int i, j;

for (i = 0; i < dim1; i++)//

{

for (j = 0; j < dim2; j++)//

cout<< << m [i][j];

cout <<"\n"; //

}

}

void print_m34 (int **m, int dim1, int dim2)

// v ,

//

{

int i, j, *v;

v = (int *) m;//

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

{

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

cout<< << v [i * dim2 + j]);

cout <<"\n";

}

}

 

 

 

1. , ?

2. ?

3. ?

4. ?

5. ?

6. ?

7. ?

8. -?

9. ?

10. void ?

11. return?

12. ?

13. inline?

14. const ?

15. ? ?

 

: !

1. , .

2. . , .

3. , , . .

4. , , . .

5. . , .

6. , . , .

7. . .

8. . .

9. . , .

10. . , K.

11. , , K. .

12. B1, B2, B3. , .

13. . , .

14. . .

15. . , .

16. . , .

17. , , . .

18. , , . .

19. , . , .

20. . .

 


[1]





:


: 2016-12-18; !; : 340 |


:

:

- - , .
==> ...

1702 - | 1648 -


© 2015-2024 lektsii.org - -

: 0.032 .