Is there user-input in the Workplace? I can't seem to respond to std::cin lines

My codes work, but they only execute std::cout and i can’t seem to input anything to the std::cins
Heres the code

int main() {
int password;

std::cout << “Please input the password first.:\n”;
std::cin >> password;

if (password == 123) {
std::cout << “Password correct! you are now being logged in.\n”;
}
else {
std::cout << “Incorrect password. You are now being relogged to the home menu.\n”;

}

1 Like

This is a very easy fix. You forgot to include a file to your code to make this work.
At the top of your code, please add this line:

#include <iostream>

This should fix the issue. If not then I don’t know. Hope this helps!

Edit:
I just noticed, you also forgot to add a } at the end of the else statement.

Most of the lessons and the Codecademy workspaces can’t accept user input. So std::cin won’t work.

1 Like