Forums Register Login

you'd think this'd work but....

+Pie Number of slices to send: Send
it doesnt! (is anyone really surprised!?)

heres the deal, i have a class, with a integer variable called ticketCount.
ticketCount is in a loop to read from a file, and increment, thus counting the number of tickets. strangely, it seems this increment never happens. despite every other command in the loop working. (and no, its not commented out!)
+Pie Number of slices to send: Send
Post your code. You are probably, in some way or another, short circuting
your loop (looping back to the top) before you ever get to your counter.
Or your counter is inside of an if/switch/whatever statement that never
gets accessed. But incrementing a variable inside of a loop definately
does work.
+Pie Number of slices to send: Send
Let me guess, you are using

counter = counter++;

If so, take a very close look at how the post increment operator works.
+Pie Number of slices to send: Send
Nice guess Ilja
I could guess some very strange things too, but prefer to wait for Richard to post his loop.
+Pie Number of slices to send: Send



Ticket is simply a class that holds an int(ticket number), an int array(the lottery numbers), and a string(suburb in which it was bought).
+Pie Number of slices to send: Send
its cool!! it works now!! booyah!!
+Pie Number of slices to send: Send
That's cool. That would also be cool to tell us where your blunder is
+Pie Number of slices to send: Send
well, clearly, i redefined tickets in the constructor (possibly me just assuming Eclipse is smarter than me.
Hey, sticks and stones baby. And maybe a wee mention of my stuff:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 832 times.
Similar Threads
uneasy code for beginners
a query regarding 'for' loop
logic:iterate incremented by 2?
increment operator in while loop
sum up numbers
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 15, 2024 23:41:30.