PROGRAMMING:Points management of sports clubs
A club has basketball, football and volleyball teams.
The framework of the base class is given below
class Ball
{
protected:
string opponent;// opponent
public:
void display();// Show results
}
Taking ball as the base class, three classes of basketball, football and volleyball are constructed.
Generate the above class and write the main function, which requires that there is a base class ball pointer array in the main function, with no more than 20 array elements.
Ball *pb[20];
Main function according to the input information, the corresponding establishment of basketball, football, volleyball class objects.
Input format: each test case occupies one line, the first item is type, 1 is basketball, 2 is football, 3 is volleyball, the second item is opponent name, the second item is score. Enter 0 to end the input.
When outputting, print the opponent's name and the score of the game (in 10000 yuan): basketball wins one game and gets 2 points, and loses one game and gets 1 point; Football wins a game and gets 3 points, draws a game and gets 1 point; When volleyball wins 3:0 or 3:1, it gets 3 points; when it wins 3:2, it gets 2 points; when it loses 2:3, it gets 1 point; otherwise, it gets 0 point.
Input sample
1 AAA 108:106
2 BB 2:1
3 CCC 3:2
2 BB 2:2
3 EEE 3:1
3 FFF 2:3
3 CCC 0:3
1 AAA 95:99
0
Output sample
AAA 2
BB 3
CCC 2
BB 1
EEE 3
FFF 1
CCC 0
AAA 1
answer:If there is no answer, please comment
The framework of the base class is given below
class Ball
{
protected:
string opponent;// opponent
public:
void display();// Show results
}
Taking ball as the base class, three classes of basketball, football and volleyball are constructed.
Generate the above class and write the main function, which requires that there is a base class ball pointer array in the main function, with no more than 20 array elements.
Ball *pb[20];
Main function according to the input information, the corresponding establishment of basketball, football, volleyball class objects.
Input format: each test case occupies one line, the first item is type, 1 is basketball, 2 is football, 3 is volleyball, the second item is opponent name, the second item is score. Enter 0 to end the input.
When outputting, print the opponent's name and the score of the game (in 10000 yuan): basketball wins one game and gets 2 points, and loses one game and gets 1 point; Football wins a game and gets 3 points, draws a game and gets 1 point; When volleyball wins 3:0 or 3:1, it gets 3 points; when it wins 3:2, it gets 2 points; when it loses 2:3, it gets 1 point; otherwise, it gets 0 point.
Input sample
1 AAA 108:106
2 BB 2:1
3 CCC 3:2
2 BB 2:2
3 EEE 3:1
3 FFF 2:3
3 CCC 0:3
1 AAA 95:99
0
Output sample
AAA 2
BB 3
CCC 2
BB 1
EEE 3
FFF 1
CCC 0
AAA 1
answer:If there is no answer, please comment