What am I doing wrong

Okay, so I am working on a project and here is one of the questions

1. Write a program that calculates the number of huge, large, medium, and small containers needed to send the shipment in the minimum number of containers and with the minimum amount of wasted container space.

And here is what I wrote down

cout << "No. Doflingies: " << totDoflingies;

cout << " \n";

totDoflingies / huge = Hugeboxes;
totDoflingies % huge = remainderDoflingies;
remainderDoflingies / large = Largeboxes;
remainderDoflingies % large = leftoverDoflingies;
leftoverDoflingies / medium = Mediumboxes;
leftoverDoflingies % medium = Smallboxes;


cout << "Container Size Number Required\n";
cout << "--------------- ----------------\n";
cout << "Huge \n" << Hugeboxes;
cout << "Large \n" << Largeboxes;
cout << "Medium \n" << Mediumboxes;
cout << "Small " << Smallboxes;
}

But this isn't working for some reason, and I don't know why
Last edited on
You havent created a variable for anything, thats most of your problem.
1
2
3
4
5
6
totDoflingies / huge = Hugeboxes;
totDoflingies % huge = remainderDoflingies;
remainderDoflingies / large = Largeboxes;
remainderDoflingies % large = leftoverDoflingies;
leftoverDoflingies / medium = Mediumboxes;
leftoverDoflingies % medium = Smallboxes;

You can't do arithmetic on the left side of the assignment operator.

PLEASE USE CODE TAGS (the <> formatting button) when posting code.
http://v2.cplusplus.com/articles/jEywvCM9/
It makes it easier to read your code and it also makes it easier to respond to your post.
Hint: You can edit your previous post, highlight your code and press the <> formatting button.
Last edited on
... Guessing this is not all of your code than whoops. Like @AbstractionAnon said. Your arithmetics have to look like this instead -

1
2
Hugeboxes = totDoflingies / huge;
remainderDoflingies = totDoflingies % huge;


etc.
I actually checked back at my video lessons and solved it myself but thanks!
Topic archived. No new replies allowed.