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

前端 未结 6 1666
别跟我提以往
别跟我提以往 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:38

    for(myAnimal.length(); i > -1; i--){
        ^
    

    this doesn't do anything. you fetch the value and then throw it away.

    Did you mean i = myAnimal.length() - 1 ?

提交回复
热议问题