- Home
- Course Category
- Course Result
- Course Detail
Hot Line: 0124-2383121
Course Introduction
Programs for practice
Following C++ program ask to the user to enter the string to copy it into another string, then display the copied string on the screen :
Source Code: Print Hello World
/* C++ Program - Copy String */
#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<stdio.h>
void main()
{
clrscr();
char str1[20], str2[20];
cout<<"Enter a string : ";
gets(str1);
cout<<"copying string 1 into string 2 ......\n";
strcpy(str2, str1);
cout<<"String 2 after copying "<<str2;
getch();
}
Output
Enter a string : blazingminds
copying string 1 into string 2 ......
String 2 after copying blazingminds