#include<stdio.h>
#include<conio.h>
#include<iostream.h>

class copy
{
public:
char de;
char gf;


void xtrcpy(char*t,char*s)
{
while(*s !='\0')
  {
*t=*s;
s++;
t++;

}

*t='\0';
cout<<"enter the first name:";
cin>>de;
cout<<"enter the second name:";
cin>>gf;

xtrcpy(de,gf);
cout<<"\n de="<<de;
cout<<"\n gf="<<gf;
}
} ;
main()
{
copy v;
v.xtrcpy();
return (0);
}

Please post some code to show what you've done so far.
And you might 'wanna' read this.

Regards Niek

Always post your code in code tags, read the forum announcements for more details.

As far as the problem is concerned, dont know what exactly are you trying to achieve here. You are struggling with your syntax. Here, I will give you a prototype of how your program should look like:

#include <iostream> // .h format of header declaration is depreceated
#include <string>
using namespace std ; // use this new way of declaring headers

void xcopy( char* destination, const char* source )
{
   //your function here
}

int main( ) // the correct way of using main( )
{
    // declare and initialize variables
   // accept input from user
   // call the function
   // display the result
}

Just to let you know that you have forgot the closing brace of your function and are getting your syntax all wrong.

This article has been dead for over six months. Start a new discussion instead.