<< and >> in C ++

Possible duplicate:
<<and → → in C ++

I don’t quite understand what this means ... I am just learning C ++ from my very very basic Python experience ... and so this can be a very stupid question. My question is ... let's say you have your classic Hello World program and you have a line:

cout<<"Hello World!"<<endl;

which means <means ... because I was just looking at using input in C and seeing that you would do something like:

int i;
cin>>i;

and I noticed that it has → instead of <<and I read that these are bitwise shifts ... and I don’t quite understand what it is ... but I think it could be different here ... Help ... thanks in advance

+3
source share
2 answers

++ . ++ ( , +, - *), , :

Foo x = 100;
Foo y = 200;
x = x + y;

++ IOstreams C stdio.h, printf. << >> " " " " . , :

std::cout << "Hello world";

... "Hello World" cout, . - - , , (, ..).

+10

. .

: 10 = 1010 (8x1 + 4x0 + 2x1 + 1x0).

.

Left shift:
10100 and that (16x1 + 8x0 + 4x1 + 2x0 + 1x0) or 20. You multiplied by two!

Right shift:
101 (4x1 + 2x0 + 1x0) or 5. You divided by two!

2.

.

, cin i:

int i;
cin>>i;

"Hello world" , cout:

cout<<"Hello World!"<<endl;
+6

Source: https://habr.com/ru/post/1794838/


All Articles