Printing dynamic arrays

Hi! I'm still quite new to c++ and I've found a problem with one of my projects. So I have this array
1
2
3
4
5
6
7
8
9
void Interface::vecProd(){
	Product *p;
	p=new Product [1];
	p[0].setName("Meat");
	p[0].setPrice(20);
	p[1].setName("Spaghetti");
	p[1].setPrice(15);
}


How do I call the name and price so I can print them?
ex. cout<<"You have just bought: " Name;
I apologize if this isn't a suitable place to post this question but I'm new to these forums as well.
 
p=new Product [1];


mean that you have just one array

1
2
3
4
	p[0].setName("Meat");
	p[0].setPrice(20);
	p[1].setName("Spaghetti");
	p[1].setPrice(15);


this mean that you want to assign in two-array variable
Topic archived. No new replies allowed.