瀏覽單個文章
flowofsoul
Major Member
 
flowofsoul的大頭照
 

加入日期: Jul 2004
文章: 292
嗯,回頭看看大家寫的,比小弟的短很多耶 (說的是源碼)。

不過我照8:5兄的源碼
while(c){
if(c > max1){
max2 = max1;
max1 = c;
cout << "max1 " << max1 << endl;
}
else if(max1 > c && c > max2){
max2 = c ;
cout << "max2 " << max2 << endl;
}

cin >> c;
}
cout << "max " << max1 << " max2 " << max2 << endl;

如果只按一個數字就直接按0輸出會出現怪異的現象...

但是比小弟寫的簡短多了,真搞不懂我腦袋在裝什麼,那麼簡單卻給他寫的那麼雜.....

樓主照8:5兄的寫法就ok了。
     
      
舊 2004-10-29, 06:04 AM #41
回應時引用此文章
flowofsoul離線中