In this program, we are going to share copy strings program in c++ programming language with the output. If you are a beginner and want to start learning the c++ programming, then keep your close attention in this tutorial as I am going to share a C++ program to copy strings with the output.
Copy the below C++ program and execute it with the help of Turbo C compiler. At the end of this program, We have shared the output of this program.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | #include <iostream> #include <cstring> using namespace std; int main() { char string1[100], string2[100]; cout << "Enter string string1: "; cin.getline(string1, 100); strcpy(s2, s1); cout << "string1 = "<< string1 << endl; cout << "string2 = "<< string2; return 0; } |
Enter string string1: freewebmentor
string1 = freewebmentor
string2 = freewebmentor
Liked this program? Do Like & share with your friends.
Article Tags: c++ program to concatenate two strings, c++ program to copy one string to another without using string functions, c++ programs for string operations, c++ programs with example, copy one string to another in c++ without using strcpy, copy string objects in C++, string copy function in c++, string copy in c++ using pointers