Pic very related, the code doesn't even work. It's just an infinite loop because the loop doesn't terminate when the user enters a return.
>>61342683
it's called ctrl+c genius
have you tried pressing ctrl-d you fucking inbred
also take note of how much less readable that is than it's c counterpartwhile ((c =getchar()) != EOF) {
sum += c - '0'
}
>>61342739
Are you fucking terminally retarded? That terminates programs immediately, it would not output the sum.
>>61342683
You're reading into an int. Input a letter and
while(std::cin >> value)
will evaluate to false, it therefore won't execute
sum += value
and then the execution will continue.
>>61342768
>less readable
the only thing you´d have a point is ">>"
everything else is clear as day
and seriously
sum += c - '0'
is not and will never be more readable than
sum += value
>>61342917
subtracting '0' makes the conversion explicit, and will save you from many errors.
otherwise you're just lying to yourself, and that is the definition of confusion.
considering there are basically two differences (and i just clarified the one you didn't give to me), there's not really much else to argue on, and the stream out certainly isn't readable.
>>61343050
ok that´s reasonable
i came at it from a pure "if someone who doesn´t program at all can´t read it and tell what happens it´s not readable" perspective
sorry for that
i think i´m growing dumber from teaching c++
put EOF
ctrl+d
>>61342768
less reasable... unless you know C++
unless you know that iostreams can be converted to bools...
>>61342768
hurr durr Japanese is so unreadable
>>61342768
Retarded idiot.
>>61342683
Some say C++ Prime Plus is the shittiest one.
Never had a problem with it though...
>>61342683
>user enters a return
There is no user. The expected input is obviously a file from the description above the code