Std::cin not working for me

I’m trying to make a simple program with user input, but std::cin is not working. The std::cout commands are working properly, but they both execute without giving me a chance to input anything. I’ve checked my code repeatedly, but I can’t see a problem. Here is my code:


int main()

std::string words;

std::cout << "Enter action: ";
std::cin >> words;
std::cout << "\nYou have chosen to " << words << “.”;


Most of the Codecademy lessons and workspaces don’t allow for user input (to the console) so std::cin wouldn’t work there.

The courses can be a bit weird to be honest. By the looks of it everything should be good, I reccomend that you click “run” on the lesson twice to allow the “solution” button to pop up and you can take a glimpse of what it wants you to fix. It’s weird how in; Line 1: #include Doesn’t need (iostream). I know that’s how they made it but just a head’s up, in normal C++ codes/projects you will need to add the (iostream).

I’m not too sure if this is a solution but it’s worth a try.

std::cin >> words; >>> changed to std::cin >> words >> “\n”;

However, I could be wrong, just try the first method I mentioned about the “solution” button.