c++ - How does std::cin works? -


i int doing following:

int num; cin >> num; 

i string doing following:

string word; cin >> word; 

my question is: how cin conversion internally? ever output error if enter unexpected? example: "ɔool ʇǝxʇ ƃǝuǝɹɐʇoɹ oulıuǝ". safeguard cin uses?

i'm new c++

note >> operator. c++ provides ability define functions give functionality built-in operator. (note, cannot create new operators don't exist in language.) in particular case, >> operator has been overloaded use cin , either int or string. these functions carry out conversion. in case of int version, set error flag in cin if input cannot converted int.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -