Reverse function | Sololearn: Learn to code for FREE!

0

Reverse function

If i input 12345 and the output must be 54321. How i code that?

cpp

9/21/2018 6:47:09 AM

Jerald De Vera

5 Answers

New Answer

+3

Try this Reverse Input https://code.sololearn.com/cYKFEhqRV2V8/?ref=app

+3

Jerald De Vera Press the check next to Lair s answer.

+2

#include <iostream> #include <string> using namespace std; int main() { string input; cin>>input; int b; b = input.size(); string tot,setl,name=input; for(int x=0;x<=input.size();x++){ setl = name.erase(0,b); name = input.substr(0,b); tot=tot+setl; b--; } cout<<tot; } https://code.sololearn.com/cWed90kf1dC7/?ref=app

0

https://code.sololearn.com/c1uDJWYWdKKn/?ref=app

0

Thankyou yall 😊