#include <iostream>
#include <string>
using namespace std;
struct CandyBar
{
string brand;
double weight;
int calories;
};
int main()
{
CandyBar * snacks = new CandyBar[3];
for (int i = 0; i < 3; i++)
{
cout << "Enter the name of candy bar number " << i + 1 << ": ";
getline(cin, snacks[i].brand);
cout << endl;
cout << "Enter the weight of candy bar number " << i + 1 << ": ";
cin >> snacks[i].weight;
cout << endl;
cout << "Enter the calories in candy bar number " << i + 1 << ": ";
cin >> snacks[i].calories;
cin.get();
cout << endl;
}
for (int i = 0; i < 3; i++)
{
cout << "Candy bar number " << i + 1 << " is named " << snacks[i].brand << "." << endl;
cout << "Candy bar number " << i + 1 << " weighs " << snacks[i].weight << " oz." << endl;
cout << "Candy bar number " << i + 1 << " has " << snacks[i].calories << " calories." << endl;
}
delete [] snacks;
cin.get();
cin.get();
}