array bound is not an integer constant before â]â token
#include <iostream> using namespace std; int limitUsernames = 0, limitPasswords = 0, lastUsername = 0, lastPassword = 0; string loggedUsernames[limitUsernames], loggedPasswords[limitPasswords]; string tryUsername, tryPassword, loginUsername, loginPassword; class Register { public: bool checkUsernameAvailability() { string checkUsernames; bool usernameTaken = false; bool usernameAvailabilityStatus = true; for (int iterator = 0; iterator < limitUsernames; iterator++) { checkUsernames = loggedUsernames[iterator]; if (checkUsernames == loggedUsernames) usernameTaken = true; } if (usernameTaken == true) { usernameAvailabilityStatus = false; } return usernameAvailabilityStatus; } void registerUsername() { cout << "Enter username: "; cin >> tryUsername; if (checkUsernameAvailability()) { lastUsername = limitUsernames; limitUsernames++; loggedUsernames[lastUsername] = tryUsername; cout << "Username successfully registered."; } else { cout << "Error at line 26 - Username already taken." << endl << "Function checkUsernameAvailability() returned false." << endl; } } }; class Password { public: void registerPassword() { cout << "Enter password: "; cin >> tryPassword; lastPassword = limitPasswords; limitPasswords++; loggedPasswords[lastPassword] = tryPassword; cout << "Password registered into account."; } }; class AccountLogin { public: bool checkUsernameExistence() { bool usernameExistenceStatus = false; for (int iterator = 0; iterator < limitUsernames; iterator++) { if (loginUsername == loggedUsernames[iterator]) { usernameExistenceStatus = true; int indexOfUsername = iterator; }