装载声明:http://blog.csdn.net/lxsmk9059/article/details/77920206?locationNum=1&fps=1
1 int array[] = {1,12,58,369,45,17,59,3654,370}; 2 int max = array[0]; 3 int secondmax = array[0]; 4 5 for(int i = 0; i < sizeof(array)/sizeof(int); i++) 6 { 7 if(array[i] > max) 8 { 9 secondmax = max; 10 max = array[i]; 11 } 12 else if(array[i] > secondmax) 13 { 14 secondmax = array[i]; 15 } 16 }
原文地址:https://www.cnblogs.com/lucong-white/p/8604142.html
时间: 2024-10-11 19:10:55