NeoYang 發表於 2007-5-25 10:39:36

簡單陣列

#include<iostream>
using namespace std ;
const int Totle = 4 ;
int Add;



int main()
{
    cout << "Input 1 = " ;
    cin >> Add ;
    cout << "Input 2 = " ;
    cin >> Add ;
    cout << "Input 3 = " ;
    cin >> Add ;
    cout << "Input 4 = " ;
    cin >> Add ;
    cout << "Input 5 = " ;
    cin >> Add ;
   
    cout << Add << " " << Add << " " << Add << " " << Add << " " << Add ;
   
    system("PAUSE") ;
    return 0 ;
}

NeoYang 發表於 2007-5-25 10:58:12

#include<iostream>
using namespace std ;
const int Totle = 4 ;
int Add;



int main()
{
    int max,min ;
    for(int LoopA=0;LoopA<=Totle;LoopA++)
    {
      cout << "Input " << LoopA+1 << " = " ;
      cin >> Add ;
    }
    for(int LoopB=0;LoopB<=Totle;LoopB++)
    {
      cout << Add << " " ;
      min = Add;
      if(min>max)
      {
            max=min;
      }
    }
    cout << endl << "MAX = "<< max ;
   
    system("PAUSE") ;
    return 0 ;
}
頁: [1]
查看完整版本: 簡單陣列

Checking the Pageranks