I have a problem with the c++ code below. The problem is that after the user has typed in the input, the black screen disappears very fast. I would like the black screen to stay up until I have pressed the enter button. I have tried using the cin.get(), but I am new to c++, and I don't understand what is wrong. (I don't get an error code, it's just that I would like the black screen to stay). I am using Visual Studio.
#include <iostream>
#include<string>
using namespace std;
int main() {
string password = "Hello";
cout << "Enter password" << flush;
cin.get();
string input;
cin >> input;
if (input == password) {
cout << "The password is correct" << endl;
cin.get();
}
if (input != password) {
cout << "Access denied" << endl;
cin.get();
}
return 0;
}