Write a program in C++ to take input 5 strings and concatenate them in reverse order of their input, the string entered last should be present at start in the concatenated string. Print the string formed in output. Input: "A" "B" "C" "D" "E" Output: "EDCBE"
Write a
Input:
"A"
"B"
"C"
"D"
"E"
Output: "EDCBE"
Write a program in C++ to take input 5 strings and concatenate them in reverse order of their input, the string entered last should be present at the start in the concatenated string. Print the string formed in output.
Algorithm:
Use a loop that runs for 5 iterations to take input 5 strings. Push all the strings in a stack of strings and then after pushing 5 strings, initialize an empty string to store the concatenated string. Pop out all strings one by one from the stack and add them to the empty string until the stack does not become empty. Print the string formed in output.
Step by step
Solved in 4 steps with 2 images