Calculate Total

Apr 27, 2011 at 8:38pm
n/a
Last edited on May 2, 2011 at 12:03am
Apr 27, 2011 at 8:50pm
Look at main() and only main(). You set the number and total of pizza, wings and bread to zero. Their values never change. 0 * anything = 0. You seem to be trying to calculate with these values before you have set them to anything.
Apr 28, 2011 at 12:15am
n/a
Last edited on May 2, 2011 at 12:03am
Apr 28, 2011 at 9:36am
The comment from abellia confused you somewhat, huh? ;)

Nono it's pefectly ok to initialze the variables. If you leave your ...Num variables 0 then the ...Total variables will be 0 as well (the same applies for unitialized).

So you have to ask the user how many pieces he want before you're calculating the result (...Total) and not after (like in displayResults()).
Topic archived. No new replies allowed.