#include<iostream>
#include <string>
usingnamespace std;
int main()
{
string Item="";
char name[50] ;
cout<< "enter ur name";
cin.getline ( name, 50 );
char prodcut[50];
cout<< "enter ur name";
cin.getline ( prodcut, 50 );
string sale [name][prodcut];
int n,m;
for (n=0;n<name[n];n++)
for (m=0;m<prodcut[m];m++)
{
cout<<"\nplease enter the name of index ["<<n<<" ] and [ "<<m<<" ] \n";
cin>>Item;
sale[n][m]=Item;
cout<< sale[n][m];
}
cin.getline ( );
}
For one, your for loop isn't nested as you want it to be. Your first for loop doesn't have brackets around its inner for loop.
1 2
for(n=0;n<name[n];n++) //missing brackets after this
for(m=0;m<prodcut[m];m++)
I don't understand the use of prodcut and name, when you ask the name twice and use name and prodcut (char arrays) as dimensions for an array.