Write a program that takes a string as input from the user


c++ program
Reverse
Write a program that takes a string as input (from the user) and then reverses the contents of the string. Your program should work by using two pointers. The "head" pointer should be set to the address of the first character in the string, and the "tail" pointer should be set to the address of the last character in the string (i.e. the character before the terminating null). The program should swap the characters referenced by these pointers, increment "head" to point to the next character, decrement "tail" to point to the second to last character, and so on, until all characters have been swapped and the entire string reversed.
Hint: Use the length of the string to calculate the address of the last character in the string. Loop until head >= tail. You may have to convert your string variable to an array of char- acters.
Filename: reverse.cpp

Solution Preview :

Prepared by a verified Expert
C/C++ Programming: Write a program that takes a string as input from the user
Reference No:- TGS0761192

Now Priced at $40 (50% Discount)

Recommended (90%)

Rated (4.3/5)