The type of X is string which of course doesn't have code as member. Change the type of X to product and yes, if you want to access certain members like code you need to make them public.
1 2 3 4 5 6
product* X = new product[50];
for(i=0;i<N;i++)
{
if(name==search)
X[i]->name=name;
cout << X[i]-> code=Code << endl;