I have programmed a game where you guess a number (1-6) and if the number is equal to the random number then give the player score + 10. But if I have selected for example 4 players then if the game will give player 1 a score it gives player 2 a score instead? What can be causing this error?I do not understand what's wrong with this?Code:#include <iostream> #include <cstdlib> #include <ctime> using namespace std; int cube; int number[4]; int player[4] = {1, 2, 3, 4}; // 0, 1, 2, 3 int victorys[4]; int score[4]; signed int howMany; string gotScore = "SCORE: "; class GameFunctions { public: void HowManyPlayers() { /* Lets the use enter how many players that want to play the game. Using a for-loop in another class and the variable hwoMany to represent the value that the user entered*/ do { system("CLS"); cout << "1 - One Player" << endl; cout << "2 - Two Players" << endl; cout << "3 - Three Players" << endl; cout << "4 - Four Players" << endl; cout << "How many players: "; cin >> howMany; } while (howMany <= 0); } void throwCube() { /* Made to throw a random number to the user */ srand(time(NULL)); cube = rand() % 6 + 1; cout << "CUBE NUMBER: " << cube << endl; } void check() { /* Made to check if the user got any scores */ if (number[0] == cube) { score[0] += 10; cout << gotScore << score[0] << endl; } else if (number[1] == cube) { score[1] += 10; cout << gotScore << score[1] << endl; } else if (number[2] == cube) { score[2] += 10; cout << gotScore << score[2] << endl; } else if (number[3] == cube) { score[3] += 10; cout << gotScore << score[3] << endl; } //End of checking for scores /* Checking for victorys */ if (score[0] == 10) { victorys[0]++; cout << "VICTORYS: " << victorys[0] << endl; cout << "PLAYER " << player[0] << " WON!" << endl; system("PAUSE"); HowManyPlayers(); } else if (score[1] == 10) { victorys[1]++; cout << "VICTORYS: " << victorys[1] << endl; cout << "PLAYER " << player[1] << " WON!" << endl; system("PAUSE"); HowManyPlayers(); } else if (score[2] == 10) { victorys[2]++; cout << "VICTORYS: " << victorys[2] << endl; cout << "PLAYER " << player[2] << " WON!" << endl; system("PAUSE"); HowManyPlayers(); } else if (score[3] == 10) { victorys[3]++; cout << "VICTORYS: " << victorys[3] << endl; cout << "PLAYER " << player[3] << " WON!" << endl; system("PAUSE"); HowManyPlayers(); } //End of checking for victorys } friend class Players; }; class Players : public GameFunctions { public: int inputNumbers() { /* The for-loop is really important here. It makes the user to select how many players */ for (int i = 0; i < howMany; i++) { system("CLS"); cout << "VICTORYS: " << victorys[i] << endl; cout << "PLAYER " << player[i] << endl; cout << "SCORE: " << score[i] << endl; cout << "ENTER NUMBER PLAYER " << player[i] << ": "; cin >> number[i]; throwCube(); check(); system("PAUSE"); } return 0; } }; int main() { bool menu = true; Players obj; obj.HowManyPlayers(); while (menu == true) { obj.inputNumbers(); } return 0; }