We have replaced the call to printf with the standard C++ function
cout. The header file <iostream.h> is then needed.
In addition, we don't need to
declare variables like r and s at the beginning of the program.
I personally prefer
however to declare all variables at the beginning of a function, as this
gives me a feeling of greater readability.