void login() {
//username, password, option to register, option to exit, link to website
cout << "Would you like to login(1), or press anything else to register.?" << endl;
cin >> loginYorN;
if (loginYorN == 1) {
cout << "Please enter your username: ";
cin >> accountInfo[1];
cout << endl << "Please enter your password: ";
cin >> accountInfo[2];
ifstream login;
login.open ("login.csv");
if(accountInfo[1] == acountID && accountInfo[2] == accountPW) {
worldSelect();
} else {
cout << "Please try again, as you have enter the wrong information." << endl;
login();
//check if login details match what they inputted
login.close;
}
login.close;
} else {
reigsterAccount();
}
}
So as above, I ask them to input 1 for login, anything else for register. Whatever they input, it get's stored into loginYorN, then I check to see what they input. If they put '1' for input, then I ask them for their username, store that into accountInfo[1], and then asking for the password, storing that into accountInfo[2].
Now here is where I need to input line 1(username) from login.csv or login.txt and line2(password) and storage these into accountID and accountPW.
Ive tried taken several routes with this, have yet to find something that works. Hoping I get something good here.