Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
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
