@Maryrocks thank you, that was very easy to understand! I ended up solving it (while keeping the fstream and not using vectors) last night. But for the other route that my code will follow I want to add vectors so ill try with the one you sent me. Thank you so much. Vectors has always been so daunting to me but your code was so simple it really ease my worries.
This is the fixed code (with fstream and no vector)
int main() {
user u;
login verify;
cout<<"\nAre you a new user? (y/n)";
cin>>u.choice1;
if (u.choice1 == 'y')
{
int attempts, success;
//checks for success of username match
//user is given 3 attempts
for (attempts = 1; attempts < 4; attempts++) {
success = verify.checkusername();
if (success == 1) {
break; // it will jump to the check pass thing
}
}
//if inspite of those 3 attemps user still has not succeeded if(success == 0 ) will provide a new route
if (success == 0) // they have done all 3 attempts and still success is 0
{
//code for what happens if user can't have all 3 tries
}
verify.checkpassword();
verify.creatnewpass();
}
elseif (u.choice1 == 'n') {
cout<<"cnoij";
}
else {
cout<<"error";
}
return 0;
}