上传文件至「20260314」
This commit is contained in:
14
20260314/求最大值指针.cpp
Normal file
14
20260314/求最大值指针.cpp
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
#include<iostream>
|
||||||
|
using namespace std;
|
||||||
|
int main(){
|
||||||
|
int a[10]={15,217,450,2,30,930,23,6,19,8};
|
||||||
|
int * ptr_a;
|
||||||
|
ptr_a=a;
|
||||||
|
for(int i=1;i<10;i++){
|
||||||
|
if(*ptr_a<a[i]){
|
||||||
|
*ptr_a=a[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cout<<*ptr_a<<endl;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user