I was recently asked to compare the functionality of atoi() and std::stringstream. Here’s the code:

And here’s the output: So it looks like the functionality of both is actually very similar (though note std::stringstream has many ways to modify its behaviour); unfortunately it seems the stream doesn’t set the result to zero when…