I am making a username and password database, my problem is that the program only see's the first user in the array and not any other users. I am sure this is a simple fix, or maybe I am grabbing the information wrong. Thank you in advance.
Thank you for your comment, but I don't see how this helps me. I already have that, just I'm having problems with comparing what's inside my 2D array to what the user inputs.
Line 50, will break operation on first check, you might want to for loop continue unless all names have been checked.
see comments..
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
for (int i = 0; i<10; i++) {
// putting this inside for loop to redisplay the question
cout << "Input your username\n";
cin >> user;
if (data[i][0] == user) {
/// the rest of the code ...
// if username is wrong check next one, also show checking info.
else {
cout<<"current check is: " << i + 1 << "\n";
if(i == 9) cout<<"Invalid Username\n"; // if none checks passed, show fail.
continue; // continue until i < 10, if i == 9 for loop will break.
}
}
there are other things worth considering such what will program do if file fails to open?
consider making checks for that too.