Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Write a section of C++ code, and use lower pointer method and pointer variable method to find the minimum element, maximum element and subscript of an integer two-dimensional array;
Write a section of C++ code, and use lower pointer method and pointer variable method to find the minimum element, maximum element and subscript of an integer two-dimensional array;
# include & ltiostream & gt

Use namespace std

void main(){

int Date[2][2]={{ 1,2},{2,3 } };

int Min,Max

Min = * * Date// Give the value of the first address data to Min(*Date means the first address).

max = Date[0][0];

/* pointer */

for(int k = 1; k & lt4; K++){ //4 is a number.

If( *(*Date+k- 1)>*(* date +k) ){

min = *(* Date+k);

}

}

cout & lt& lt" Min:" & lt; & ltMin & lt& ltendl

/* Subscript */

for(int I = 0; I<2; I++){ //2 is the number of rows.

for(int j = 0; j & lt2; j++){

if(Max & lt; Date [i][j] ){

max = Date[I][j];

}

}

}

cout & lt& lt" Max:" & lt; & ltMax & lt& ltendl

}