mbozzi is correct as well as jonnin. I'll chime in my two cents as well:
You're assuming that AND statements can be used to collect elements.
Take a look at this code.
1 2
|
string myString = "abc";
cout << myString.at(0&&1&&2));
|
You might assume that this is going to return "abc". But behind the scenes,
0&&1&&2
is actually a function which returns
This may seem unintuitive, but in C++,
and
are actually the same thing. Likewise,
is the same thing as
So what happens instead?
0&&1&&2
will be evaluated to false. You're code is going to get calculated down to the following statement.
1 2
|
string myString = "abc";
cout << myString.at(0));
|
which means, only get the first letter in my string. So actually you're only going to print "A".
I hope that helps!