
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
C++ Program to Concatenate Strings in Reverse Order
Suppose we have two strings S and T. Both are in lowercase letters. Concatenate T and S in this order to generate the final string.
So, if the input is like S = "ramming"; T = "prog", then the output will be "programming"
Steps
To solve this, we will follow these steps −
res := T concatenate S return res
Example
Let us see the following implementation to get better understanding −
#include <bits/stdc++.h> using namespace std; string solve(string S, string T){ string res = T + S; return res; } int main(){ string S = "ramming"; string T = "prog"; cout << solve(S, T) << endl; }
Input
"ramming", "prog"
Output
programming
Advertisements