There are a lot of inconsistencies.
There are constants
1 2
|
const int N_P_T = 5;
int const NGAME = 10;
|
which are occasionally used in the code, but other times there are things like:
1 2 3 4
|
for (int i = 0; i < 5; i++)
for (int i = 0; i < 10; i++)
for (int pnc=0;pnc<7;pnc++)
double scorem[10]
|
Don't use magic numbers - make use of the named constants instead.
More of a problem is the matching of
new[]
with
delete[]
That is almost certainly an issue.
Here, the pointer is not initialised at all:
PLAYER(){};
Here, it is allocated with new,
Points= new double[10];
Here it is assigned the value of some other array:
Points = score;
However, in the destructor,
|
~PLAYER() { delete [] Points; }
|
the pointer is always deleted, regardless of whether or not it is valid.
The easiest solution might be to not use new/delete at all, Just define a fixed-size array.
Edit: Also, look at this:
1 2 3
|
const int N_P_T = 5;
PLAYER team[N_P_T];
|
1 2 3 4 5
|
for (int pnc=0;pnc<7;pnc++)
{
team[pnc+1].setPlayerName(namem);
team[pnc+1].setDescription(descm);
}
|
valid subscripts for array team[] are 0, 1, 2, 2, 4.
The above loop modifies elements 1, 2, 3, 4, 5, 6, 7
Element 0 is ignored, which is harmless. However, attempting to modify non-existent elements 5, 6 and 7 is surely a problem.