Computer Science Canada Counting loops |
Author: | HB [ Tue Apr 03, 2012 10:27 am ] | ||
Post subject: | Counting loops | ||
What is it you are trying to achieve? Trying to get my pricing program to count the # of tickets (how many loops), and what the total price will be What is the problem you are having? I can get the loop working but when i finish the loop i cant get it to count Describe what you have tried to solve this problem I've tried using forloops and failed Post any relevant code (You may choose to attach the file instead of posting the code if it is too long) <Answer Here>
|
Author: | Dreadnought [ Tue Apr 03, 2012 1:03 pm ] |
Post subject: | Re: Counting loops |
Use a variable to keep track of things like the number of tickets sold. Set it to zero at the start, then just add to it as you receive input. |
Author: | HB [ Wed Apr 04, 2012 9:43 am ] |
Post subject: | Re: Counting loops |
var tickets:int var total:real what now? |
Author: | Dreadnought [ Wed Apr 04, 2012 11:24 am ] |
Post subject: | Re: Counting loops |
Every time you sell a ticket add 1 to the number of tickets sold, and add the price to the total cost. (Make sure you start the variables at zero) |