adsense

Hii, welcome to my site. My name is Om prakash kartik. This blog helps you to learn programming languages concepts.

Program in C++ to copy one word into another word

Program in C++ to copy one word into another word


#include<iostream>
#include<conio.h>
 using namespace std;
    void Strcpy(char *str1,char *str2)
    {
     int i;
     for(i=0;str2[i]!='\0';i++)
      str1[i]=str2[i];
      str1[i]='\0';
    }    
 int main()
  {
   char str[20],str1[20];
     cout<<"Enter first word:-";
     cin>>str;
     cout<<"Enter second word:-";
     cin>>str1;
     cout<<"Before copy str ="<<str;
   Strcpy(str,str1);
   cout<<"\nAfter copy str ="<<str;
   getch();
 }
Output:-







Related Programs -
  


  1. Program in C++ to compare two string
  2. Program in C++ to add two string
  3. Program in C++ to convert string Uppercase to Lowercase
  4. Program in C++ to convert string Lowercase into Uppercase   
  5. Program in C++ to count words in given sentence


Post a Comment

0 Comments