+ 1

Can anyone please give codes for 1. Reverse order of words in a sentence. 2. Reverse the entire sentence

https://code.sololearn.com/c5iDLSYJW7L4/?ref=app the logic I tried- first reversing the entire sentence. eg. "just for fun" becomes "nuf rof tsuj" then reversing each word. I. e, reverse word by word. so that it becomes "fun for just" This is not the exactly complete code. but I want a proper logic.

14th Nov 2017, 4:20 AM
madhura prasad
madhura prasad - avatar
10 Antworten
+ 3
Try to do it first, then you can return here if you have problems, people will help, but not doing it for you, rather, they assist you :)
14th Nov 2017, 4:36 AM
Ipang
+ 3
Then you can link your code in the question, please edit question, and link your code by tapping on the +Insert... button under message text input. Thanks for understanding :)
14th Nov 2017, 4:46 AM
Ipang
+ 3
If you want to learn, just share your attempts, even though It's not working. We can guide you from there then.
14th Nov 2017, 4:54 AM
Calviղ
Calviղ - avatar
+ 2
14th Nov 2017, 5:05 AM
#RahulVerma
#RahulVerma - avatar
+ 1
I am aware of it. thank you for your advice. but I tried many times. after trying only, I have asked here.
14th Nov 2017, 4:39 AM
madhura prasad
madhura prasad - avatar
+ 1
share your code to your post
14th Nov 2017, 4:39 AM
Andika Romansyah
+ 1
@madhura prasad, the bug is located in reverseStr somewhere between while(temp!='\0') and return temp; if you comment out those lines and insert return temp; before string word=temp; you have a reversed string. Try it out.
14th Nov 2017, 5:44 AM
Ipang
0
thats right... try to make first. if you get stuck, then you can share your code here..
14th Nov 2017, 4:38 AM
Andika Romansyah
0
@RahulVerma can you help me with that in c++? without lib functions
14th Nov 2017, 5:20 AM
madhura prasad
madhura prasad - avatar
0
base on rahulverma code, flow code for reverse words. get input split input per space reverse it for reverse letter. get input reverse it
14th Nov 2017, 5:44 AM
Andika Romansyah