#include #include using namespace std; /*void YNN(int sum1) { for ( int i = 0 ; i < 20 ; i ++ ) sum1 += game[1][i]; } void BOS(int sum2) { for ( int i = 0 ; i < 20 ; i ++ ) sum2 += game[2][i]; } void TB(int sum3) { for ( int i = 0 ; i < 20 ; i ++ ) sum3 += game[3][i]; }*/ void team(int game[][21]) { int grade1 = 0 , grade2 = 0 , grade3 = 0 ; int a , b ,c ; for ( int i = 0 ; i < 20 ; i++ ) { cout << "請輸入洋基隊第 " << i + 1 << " 局分數 : " ; cin >> a ; grade1 += a; cout << "請輸入紅襪隊第 " << i + 1 << " 局分數 : " ; cin >> b ; grade2 += b; cout << "請輸入光芒隊第 " << i + 1 << " 局分數 : " ; cin >> c ; grade3 += c; } cout << grade1 << endl; cout << grade2 << endl; cout << grade3 << endl; } int main(int argc, char *argv[]) { const int x = 4 ; const int y = 21 ; int game[x][y] = { 0 } ; int a , b , c ; char *q[3] = {"洋基" , "紅襪" , "光芒" }; cout << " " ; for ( int h = 0 ; h < 20 ; h++ ) cout << h + 1 << " " ; cout << endl; for( int i = 0 ; i < 3 ; i++ ) { cout << q[i] << " : "; int k = 0; for (;k < 3;) { if(k>0) cout<< " "; cout << k << " "; for ( int j = 1 ; j < 20 ; j++ ) cout << j << " "; cout << endl; break; } k++; } team(game); int m = 0; cin >> m ; cout << game[m][21]; system("PAUSE"); return EXIT_SUCCESS; }