Write code to reverses the string (take string from the user) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Write code to reverses the string (take string from the user)

c++ language

1st Mar 2017, 7:42 AM
abdul rafay
abdul rafay - avatar
2 Answers
+ 2
You could write a loop that puts every char in the string in an array. then you reverse the array and after that you write a loop to make a string back again from the array. :)
1st Mar 2017, 7:58 AM
RJP
RJP - avatar
+ 1
or you get the length of the string and then do a for loop and start with the last char and keep adding the chars to a new string
1st Mar 2017, 8:00 AM
RJP
RJP - avatar