0

Reverse function

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

21st Sep 2018, 6:47 AM
Jerald De Vera
Jerald De Vera - avatar
5 Respostas
21st Sep 2018, 6:55 AM
Manual
Manual - avatar
+ 3
Jerald De Vera Press the check next to Lair s answer.
21st Sep 2018, 7:00 AM
Manual
Manual - avatar
+ 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
21st Sep 2018, 7:06 AM
estifanos
estifanos - avatar
0
https://code.sololearn.com/c1uDJWYWdKKn/?ref=app
21st Sep 2018, 6:55 AM
Lair
0
Thankyou yall 😊
21st Sep 2018, 6:59 AM
Jerald De Vera
Jerald De Vera - avatar