Home
»
» Unlabelled
» C++ Program to Concatenate Two Strings
Write C++ Program to Concatenate Two Strings.
Source Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
| #include <iostream>
using namespace std;
int main()
{
string s1, s2, result;
cout << "Enter string s1: ";
getline (cin, s1);
cout << "Enter string s2: ";
getline (cin, s2);
result = s1 + s2;
cout << "Resultant String = "<< result;
return 0;
}
|
Enter string s1: C++ Programming
Enter string s2: is awesome.
Resultant String = C++ Programming is awesome.
Post a Comment