Why can't I type std::cout in std::cout?

I'm trying to make a translator of sorts that asks you what Python keyword you want to find the C++ equivalent of.

1
2
3
std::cout << "The equivalent of 'print()' in Python is C++ is: ";
std::cout << "std::cout\n";
std::cout << "Syntax: std::cout << "Hello"\n";


When it's time to run this section of code, it returns with exit code 0. Why?
Your section of code doesn't compile, so you might want to double-check that. You might be running an old version of the code and not knowing it.

Did you mean,
std::cout << "Syntax: std::cout << \"Hello\"\n";

You have to escape the quotes that are actually printed (\").
Last edited on
adjust your IDE so you see the difference between string literals, keywords and variable names
for example, you could use colour or made them bold or italics

> it returns with exit code 0.
0 means success (but as Ganado said, your code doesn't even compile so you are not running it)
Thanks! I changed the line of code. It turns out that there was another undetected error in a section of code that I didn't include here. Thanks for your answers and patience :)
Topic archived. No new replies allowed.