ch7_7.cpp
Upload User: puke2000
Upload Date: 2022-07-25
Package Size: 912k
Code Size: 1k
Category:

CSharp

Development Platform:

Visual C++

  1. //*********************
  2. //**    ch7_7.cpp    **
  3. //*********************
  4. #include <iostream.h>
  5. int maximum(int[][4],int,int);
  6. void main()
  7. {
  8.   int sg[3][4]={{68,77,73,86},
  9.                 {87,96,78,89},
  10.                 {90,70,81,86}};
  11.   cout <<"the max grade is " <<maximum(sg,3,4) <<endl;
  12. }
  13. int maximum(int grade[][4],int pupils,int tests)
  14. {
  15.   int max=0;
  16.   for(int i=0; i<pupils; i++)
  17.     for(int j=0; j<tests; j++)
  18.       if(grade[i][j]>max)
  19.         max=grade[i][j];
  20.   return max;
  21. }