I'm trying to make this program where one function takes in the password you write and in the checkPassword function all I do is check if the password matches the correct word. If so I print "Correct". How exactly do I implement this by breaking it down into different function, like how do I get the checkPassword function to take what I wrote in loadPassword? How do I make it run in the main function?
void loadPassword() {
std::string password;
std::cout << "Enter password: \n";
std::cin >> password;
}
std::string checkPassword(std::string password) {
std::string correct;
correct == "right";
if (password == correct) {
std::cout << "correct";
}
}
int main() {
loadPassword();
checkPassword(//HOW DO I MAKE IT TAKE WHAT I WROTE IN loadPassword);
}