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 -
- Program in C++ to compare two string
- Program in C++ to add two string
- Program in C++ to convert string Uppercase to Lowercase
- Program in C++ to convert string Lowercase into Uppercase
- Program in C++ to count words in given sentence
0 Comments