The problem I have is that when entering the same number for the 20 arrays then it loops unexpectedly asking for input, e.g. if I enter all 5's then it asks for the 6th number after the twentieth, any help would be great thanks!
in your program. If you are speaking about this loop
1 2 3 4 5 6 7
do
{
count++;
cout << "Enter mark " << count << endl;
cin >> mark[count];
}
while (count < 20);
then it has two errors. The first is that you are not initializing the element of array with index 0 and you are initializing the element with index 20 that does not belong to the acceptable range of indexes for the array.
EDIT: I would rewrite the loop the following way
1 2 3 4 5 6
do
{
cout << "Enter mark " << count + 1 << endl;
cin >> mark[count++];
}
while (count < 20);
Sorry there isn't 20 arrays but an array with 20 values if you understand. The problem is something to do with the do while loop because it when I enter the same value for each value of the array it loops back asking for more input when it should exit the loop as the count variable is not less than 20.
I think that the problem is that you are overwriting the memory occupied by count when you assign a value to mark[20];
I already showed how the correct loop could look.