0

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; }

23rd Aug 2020, 5:07 PM
Matt
1 Odpowiedź
0
I hurt my eyes 👀. please don't just copy paste your codes here, put them well organise in a code format(code playground) and paste the link of it here. I hope you understand. (where's my eye-drops? 👁️‍🗨️)
23rd Aug 2020, 5:18 PM
RKK
RKK - avatar