#include
using namespace std;
Void reverStr (const string & amp; STR) {
Size_t len=STR. The size ();
For (size_t I=len - 1; I & gt;=0; - I) {
Cout & lt;
Cout & lt;
Int main () {
String STR.
Getline (cin, STR);
ReverStr (STR);
system("pause");
return 0;
}
/* can actually reverse the output, but the output, after cout
CodePudding user response:
I - I, a more classic algorithm to judge & gt; 0, such as:
String aa="123456789"; Int a=aa. The size ();
While (a) cout & lt;
This algorithm is not crossing the line,
CodePudding user response:
Size_t is unsigned types, so when I=0, - I was not negative, but a big number, to define the I as an intCodePudding user response:
Modify, according to the example of you a little bit: