i recently came across this code:
int count=0;
for(std::string buf; std::cin>>buf;) {
count++;
}
std::cout << count;
- My doubt is what does this code do?
- how is the
cin>>buf
thing working in the condition part? - isn't it going in an infinite loop?
- trying to write it in c++11 give me error for
String
, isstd::string
different fromString
, if so, then which header do i need forString
Aucun commentaire:
Enregistrer un commentaire