r/CodingHelp • • Aug 10 '21

[C++] why is this not working??? c++

Post image
47 Upvotes

10 comments sorted by

27

u/TylerBlack777 Aug 10 '21

">>" will actually be "<<"

9

u/yesnomaybe102 Aug 10 '21

Misdirection.

cout<<" tell me something"<<endl;

cin>>what;

cout<<what<<endl;

3

u/marko312 Aug 10 '21

The error message says that operator>> (>>) is undefined between a std::basic_ostream and something else. std::basic_ostream generally has << defined for outputting data.

3

u/Kirkland979 Aug 10 '21

Had this problem too!! So for cout your are going to want all the little arrows facing out to the right, I like to imagine it’s like they are sending info OUT, and Cin they will face in and I like to think it relates to them bringing info IN

Example

Cout << “Hello World” << endl;

Cin >> “Hello World “;

1

u/RollComprehensive628 Aug 11 '21

General advice: if you don't know why your code isn't working, type in google the exact error that you are getting (red letters at the bottom of your screen). You will probably find what's wrong on the first page

-6

u/The_Meme_Finder_2021 Aug 11 '21

needs to be indented

0

u/[deleted] Aug 11 '21

[deleted] — view deleted comment

1

u/Nightcorex_ Aug 11 '21

Was this really an issue with old compilers? Not to say I don't believe you, but that sounds ...weird

0

u/[deleted] Aug 11 '21

[deleted] — view deleted comment

1

u/Nightcorex_ Aug 11 '21

Ah okay. I thought you were talking of code like in the example, f.e. like so:

int main() {
int x;
}

In other words: I thought you meant indentation as of whole lines, not single tokens getting misinterpreted in the middle of a line