Hey I am working on an example questions from a book and the question is asking to use an example but they want me to make it so you have an array of 3 structures using the new command. I have tried and do not believe I am able to figure out how to create a array of structures using the new command. Here is my code if you want to look at it.
I know I do not have anything accessing the other arrays yet but I just wanted to figure out how to create an array before I wrote out the data it needs to hold.
using namespace std;
CandyBar snack = new CandyBar;
cout<< "What is the snack's name?\n";
cout<< "What is the snack's weight?\n";
cout<< "How many caolories does it haev?\n";
cout<< "The name of the canyd bar is " << snack.name
<< " it weights " << snack.weight << " much\n and it has " << snack.calories << " calories.";
delete  snack;