找回密碼
 註冊
搜索
熱搜: 活動 交友 discuz
查看: 1885|回覆: 1

[原創] 簡單陣列

[複製鏈接]
發表於 2007-5-25 10:39:36 | 顯示全部樓層 |閲讀模式
  1. #include<iostream>
  2. using namespace std ;
  3. const int Totle = 4 ;
  4. int Add[Totle]  ;



  5. int main()
  6. {
  7.     cout << "Input 1 = " ;
  8.     cin >> Add[0] ;
  9.     cout << "Input 2 = " ;
  10.     cin >> Add[1] ;
  11.     cout << "Input 3 = " ;
  12.     cin >> Add[2] ;
  13.     cout << "Input 4 = " ;
  14.     cin >> Add[3] ;
  15.     cout << "Input 5 = " ;
  16.     cin >> Add[4] ;
  17.    
  18.     cout << Add[0] << " " << Add[1] << " " << Add[2] << " " << Add[3] << " " << Add[4] ;
  19.    
  20.     system("PAUSE") ;
  21.     return 0 ;
  22. }
複製代碼
 樓主| 發表於 2007-5-25 10:58:12 | 顯示全部樓層
  1. #include<iostream>
  2. using namespace std ;
  3. const int Totle = 4 ;
  4. int Add[Totle]  ;



  5. int main()
  6. {
  7.     int max,min ;
  8.     for(int LoopA=0;LoopA<=Totle;LoopA++)
  9.     {
  10.         cout << "Input " << LoopA+1 << " = " ;
  11.         cin >> Add[LoopA] ;
  12.     }
  13.     for(int LoopB=0;LoopB<=Totle;LoopB++)
  14.     {
  15.         cout << Add[LoopB] << " " ;
  16.         min = Add[LoopB];
  17.         if(min>max)
  18.         {
  19.             max=min;
  20.         }
  21.     }
  22.     cout << endl << "MAX = "<< max ;
  23.    
  24.     system("PAUSE") ;
  25.     return 0 ;
  26. }
複製代碼
回覆

使用道具 舉報

您需要登錄後才可以回帖 登錄 | 註冊

本版積分規則

Checking the Pageranks

Archiver|手機版|小黑屋|WEO

GMT+8, 2026-7-29 08:15 PM , Processed in 0.019934 second(s), 18 queries .

Powered by Discuz! X5.0 Licensed

© 2001-2026 Discuz! Team.

快速回復 返回頂部 返回列表