help
Archived 19 days ago
T
Tense
Verified
im doing tutorial 1.5 on learn cpp.com and i have question
in their example:
int x{};
std::cin >> x;
they input
on their site it says that "If no characters could be extracted in step 4 above, extraction has failed. The object being extracted to is copy-assigned the value 0 (as of C++11), and any future extractions will immediately fail (until std::cin is cleared)."
my understanding is of the process is that:
1.
from here it should copy-assign a value of
in their example:
int x{};
std::cin >> x;
they input
5a and the output is 5. Why is the output not 50 or just 0on their site it says that "If no characters could be extracted in step 4 above, extraction has failed. The object being extracted to is copy-assigned the value 0 (as of C++11), and any future extractions will immediately fail (until std::cin is cleared)."
my understanding is of the process is that:
1.
5 is extracted successfully2. extraction stops at the white space3. attempts to extract a but failsfrom here it should copy-assign a value of
0, but why not?