Re: need help calculating vat from multiple array items
Quote:
Originally Posted by
Kansas4Ever
OK, I have figured out what I have need to do, only have to find the average.
int avg
avg = (1 + 2 + 3 + 4 + 5+ 6 + 7 + 8 + 9 +10 + 11 + 12 + 13 (up to 35) / 35;
cout << "Avererage is : " <<avg;
Is this close?
EDIT
RDcast, I can get the vat alright with int
No. Assuming by average you mean the arithmetic mean, that's the sum of the values divided by the number of values.
Re: need help calculating vat from multiple array items
Quote:
Originally Posted by
Kansas4Ever
RDcast, I can get the vat alright with int
No you can't, unless you want it measured in cents. An int can't store anything but whole numbers. If your item was a dollar, your tax would bet 29 cents or .29. An int can't store .29 as it isn't a whole number, and it will drop any fractional components when used in division. 1/2 = 0 if you're just using integers.