Hey everyone, I am taking an online C++ class and part of our assignment is to complete a whole bunch of small program snipits on a site called myprogramminglab.com. This one program seems to have me stumped as I am not very familiar with Data structures. Could someone help me out with this?

Assume that SREC has already been defined. Define a new type, ROSTER , that is a structure consisting of an int field, size , and another field, grades , that is an SREC array with 500 elements.

Recommended Answers

All 4 Replies

Start easier. Can you define an array of 500 SREC objects?

Not sure, but if I were to guess, I would think that it would be something like this:

int SREC.testArray[500];

That's not a bad guess, but the assumption there is that SREC is its own type, so:

SREC grades[500];

No doubt you know how to declare simple integer variables:

int field;
int size;

Now the only problem is wrapping those three into a structure.

Cool, I figured out how to do it thanks to your tip/reference!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.