Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

think of an object that you can model with a C++ struct . For instance, I like b

ID: 3920436 • Letter: T

Question

think of an object that you can model with a C++ struct. For instance, I like beer so I could model somethings about beer with a structure like so:

The string strName is the name of the beer object.

The string strBrewery is the manufacturer of the beer object.

The int iSize is the volume of this beer object.

The enum Container with it's three values defines and restricts the beer object to just 3 containers. Notice the eContainer instance as a member of the structure.

The double dCostPerUint is the price of this beer object.

There are several ways to create and initialize a beer instance. One way would be to declare an instance and then initialize like so:

You can also create an array of beer objects like so:

For this assignment I would like you to define an object that can be modeled by a C++ struct. Once you declare the struct, create and initialize an array of your structures like I have done in the example above.

enum Continer BOTTLE, CAN, KEG Estruct Beer std::string strName; std::string strBrewery; int Continer eContainerType; double isize; dCostPerUint; 7:

Explanation / Answer


Given below is the code for the question. The code does not generate any output .. but just does what is asked in question... declare a struct and initialize an array.
Please do rate the answer if it was helpful. Thank you

#include <iostream>
#include <string>
using namespace std;
struct employee{
string strFirstName;
string strLastName;
int iEmpId;
double dSalary;
};

int main(){
employee emps[3]
{
{"John", "Smith", 111, 1000.00},
{"Bill", "Smith", 222, 2000.00},
{"Michael", "Jackson", 333, 3000.00}
};
}