I am not sure why you would try that.. it doesn't quite make sense.

Perhaps you want to divide the 'square feet gallon' variable by the 'roomArea - (windowArea + bookshelfArea + doorArea)' bit. Perhaps put that bit in parenthesis so it works out first BEFORE the division.

## 20 Replies - 538 Views - Last Post: 31 January 2018 - 05:41 PM

### #17

## Re: How would i make this work?

Posted 13 January 2018 - 04:58 PM

would it be like this?

paint = roomArea - (windowArea + bookshelfArea + doorArea)/SquareFeetGallon;

paint = roomArea - (windowArea + bookshelfArea + doorArea)/SquareFeetGallon;

### #19

## Re: How would i make this work?

Posted 13 January 2018 - 05:03 PM

paint = (roomArea - SquareFeetGallon)/(windowArea + bookshelfArea + doorArea);

would it be this?

would it be this?

### #20

## Re: How would i make this work?

Posted 13 January 2018 - 11:40 PM

That doesn't really make sense either: roomArea and SquareFeetGallon have different units, so you can't subtract them. Think about doing dimensional analysis: your area has dimensions of ft^2 and SquareFeetGallon has dimensions of ft^2 gal^-1 and the result you want has dimensions of gal. It should be quite simple to see how to combine the two quantities to form one with the correct dimensions.

### #21

## Re: How would i make this work?

Posted 31 January 2018 - 05:41 PM

This is a great example of a fundamental truth:

If one does not understand the problem then one cannot code a solution.

The primary problem that I see is that you do not understand the mathematics!

Can you solve this problem on the back of an envelope?

Have you tried?

It should be easy, bordering on the trivial.

Until you can do this any attempt to code a solution is doomed to failure...

For what it is worth I knocked up a solution in C++ in 5 minutes.

The coding was trivial because I understood the maths...

BTW I am no C++ guru, but I am trying to work on this.

If one does not understand the problem then one cannot code a solution.

The primary problem that I see is that you do not understand the mathematics!

Can you solve this problem on the back of an envelope?

Have you tried?

It should be easy, bordering on the trivial.

Until you can do this any attempt to code a solution is doomed to failure...

For what it is worth I knocked up a solution in C++ in 5 minutes.

The coding was trivial because I understood the maths...

BTW I am no C++ guru, but I am trying to work on this.