C++ Printing a string in reverse using a for loop

前端 未结 6 1620
别跟我提以往
别跟我提以往 2021-01-25 12:13

I have a program that prints out the characters of a string using a for-loop. It must also print the same characters in reverse, which is where I\'m having problems. Can someone

6条回答
  •  终归单人心
    2021-01-25 12:42

    Because the character positions start at 0, the last character of myAnimal is at position (myAnimal.length()-1) not myAnimal.length() so you want to start the second loop there.

提交回复
热议问题