輸出數組a中的最小值和最小值下標?
int array_int[] = {-11,2,3,43,5,6,7,-85,9,10}; int int_temp_arry_num = (int)(sizeof(array_int)/sizeof(array_int[0])); int *pbegin=array_int; int *pend=&array_int[int_temp_arry_num]; int n_max_value,n_min_value; n_max_value = (*pbegin); n_min_value = (*pbegin); for(++pbegin; pbegin != pend ; ++pbegin) { int temp_value = *pbegin; if(n_max_value < temp_value) { n_max_value = temp_value; } if(n_min_value > temp_value) { n_min_value = temp_value; } } std::cout<<n_max_value<<"\n" <<n_min_value<<"\n"; system("pause");
上一篇講座類直播禁用哪些語言
下一篇js判斷是否為空