my code works in c++ so the logical I am getting error must be in the reading of the problem, but I can't see it:

Given a type Money that is a structured type with two int fields, dollars and cents. Assume that an array named monthlySales with 12 elements, each of type Money has been declared and initialized.

Assume that a Money variable yearlySales has also been declared. Write the necessary code that traverses the monthlySales array and adds it all up and stores the resulting total in yearlySales. Be sure make sure that yearlySales ends up with a valid value, i.e. a value of cents that is less than 100.

Money monthlySales[12];
yearlySales.cents = 0;
yearlySales.dollars = 0;

for(int j = 0; j < 12; j++)
{
cin >> monthlySales[j].dollars;
cin >> monthlySales[j].cents;
}

for(int i = 0; i < 12; i++)
{
yearlySales.cents = yearlySales.cents + monthlySales[i].cents;

yearlySales.dollars = yearlySales.dollars + monthlySales[i].dollars;

}
while(yearlySales.cents > 100)
{
yearlySales.cents -= 100;
yearlySales.dollars += 1;
}

Here's a little detail:

while(yearlySales.cents 100)
{...

Can you post your Money class, data and output?

You also missed out

int main(){
}

Otherwise it should work as expected.

myprogramming lab- the bane of my existance- code works in c++ but not in myprogramminglab so I wondered if I was missing something in the question

Sorry, can't help much there. Don't have access to myprogramminglab.

But double-checking with a real programming language is the way to go.

The code you provided appears to be correct and should correctly calculate and store the yearly sales in the `yearlySales` variable.

However, if you are encountering an error, it is likely related to the input you are providing. The code expects the user to input values for the `dollars` and `cents` fields of the `monthlySales` array. If you are not providing valid input, it could lead to unexpected behavior or errors.

Make sure that you are entering valid integer values for `dollars` and `cents` when prompted by the `cin` statements inside the first `for` loop. Also, ensure that you are entering values for all 12 elements of the `monthlySales` array.

If you are still encountering issues, it would be helpful to provide more specific information about the error message or unexpected behavior you are experiencing.