+ 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.
10 Answers
+ 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 :)
+ 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 :)
+ 3
If you want to learn, just share your attempts, even though It's not working. We can guide you from there then.
+ 2
# For reversing order of string
https://code.sololearn.com/cch4drb0RwOy/?ref=app
# For reversing entire string
https://code.sololearn.com/cJL89H5DYddu/?ref=app
+ 1
I am aware of it. thank you for your advice. but I tried many times. after trying only, I have asked here.
+ 1
share your code to your post
+ 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.
0
thats right... try to make first. if you get stuck, then you can share your code here..
0
@RahulVerma can you help me with that in c++? without lib functions
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