Here we copy one string into another string without any use of predefined function.
program:
#include< iostream>
int main()
{
char ch1[20],ch2[20];
int i=0;
//input of string
cout<<"Enter string"<< endl;
cin>>ch1;
//Now copy in another
while(ch1[i]!='')
{
ch2[i]=ch1[i];
i++;
}
ch2[i]='';
cout<<"String After copy is "<< ch2;
}
Enter string
Myprogramming
String After copy is Myprogramming