#include #include #include //for class string using namespace std; int main() { struct food { string name; int calories; //calories in one serving }; const food a[] { {"Apple", 95}, {"Banana", 105}, {"Slice of pizza", 285}, {"Ice cream", 207}, {"Grilled chicken", 165} }; const size_t n {size(a)}; //number of elements in the array int total {0}; for (int i {0}; i < n; ++i) { cout << a[i].name << " has " << a[i].calories << " calories.\n"; total += a[i].calories; } cout << "\nTotal calories for all items: " << total << "\n"; return EXIT_SUCCESS; }