|
|
- #include<iostream>
- using namespace std ;
-
- int Matrix[3] ,Total = 3;
- int main()
- {
- Matrix[0] = 5 ;
- Matrix[1] = 3 ;
- Matrix[2] = 2 ;
- Matrix[3] = 4 ;
- int Temp[Total] , A , B ;
- while(A!=4)
- {
- A=0;
- B=0;
- for(int X=0;X<=Total;X=X+1)
- {
- cout << "請輸入第" << X+1 << "個數:" ;
- cin >> Temp[X] ;
- if( Temp[X] == Matrix[X] )
- {
- A=A+1;
- }
- for(int Y=0;Y<=Total;Y=Y+1)
- {
- if( X!=Y && Temp[X] == Matrix[Y] )
- {
- B=B+1;
- }
- }
- }
- cout << endl << A << "A" << B << "B" << endl ;
- }
- cout << "正確了!" << endl ;
-
- system("PAUSE") ;
- return 0 ;
- }
複製代碼 |
|