Ask coding questions

← Back to all posts
Why cin isn't working?
Telewizorekhehe

"std::cin >> x;" and i have error, why?

Voters
Telewizorekhehe
Comments
hotnewtop
Coder100

you forgot to add a semicolon, here's the correct code:

perhaps your file didn't save so take some time for this to stop blinking:

JacobBirch

Put a semicolon at the end of line 6. The error message clearly says it expected a ; and it told you where.

Telewizorekhehe

@JacobBirch I did this but this isn't working.

19ecal

You forgot the semicolon at the end of line 6 (which you would have known if you read the error message)

Telewizorekhehe

@19ecal No, I didn't

19ecal

@Telewizorekhehe Ok. When I answered your question, you had forgotten the semicolon at the end of line 6.
Now X is not defined. So, fix it by defining it, with something like std::string X; or int X;, depending on what type you want X to be.

Telewizorekhehe

@19ecal This isn't working.

19ecal

@Telewizorekhehe You forgot the semicolon at the end of line 6 (which you would have known if you read the error message)

Telewizorekhehe

@19ecal I didn't

19ecal

@Telewizorekhehe

I am seeing a distinct lack of a semicolon

Telewizorekhehe

@19ecal How is this possible????? Maybe this is repl.it bug?