forked from newde/homework
19 lines
385 B
C++
19 lines
385 B
C++
1 #include<iostream>
|
|
2 using namespace std;
|
|
3
|
|
4 int main(){
|
|
5 int max,*ptr;
|
|
6 int arr[5]={10,20,33,15,11};
|
|
7 max = arr[0];
|
|
8 ptr = arr;
|
|
9
|
|
10 for (int i = 0; i < 5; i++) {
|
|
11 if (*ptr > max) {
|
|
12 max = *ptr;
|
|
13 }
|
|
14 ptr++;
|
|
15 }
|
|
16 cout << "最大值是:"<< max<<endl;
|
|
17
|
|
18 return 0;
|
|
19 } |