Computer Science Canada Loops |
Author: | Angel [ Wed Jan 07, 2004 12:48 am ] |
Post subject: | Loops |
I have a bug in my program and don't know how to fix it. This is it: What's supposed to happen is that when the user makes a selection between quizes 1 and 2, and they type in a wrong number, the program continues to ask the user to re-enter the number until they enter 1 or 2. But when they do enter it, nothing happens. It doesn't go to quiz 1 when they enter 1 and it doesn't clear when they enter 2. Do you know how I can fix that and make sure that it does that stuff when the user finally enters the correct number? If you do, can you please make the necessary changes in the program and post it? Thanks. |
Author: | shorthair [ Wed Jan 07, 2004 11:22 am ] | ||
Post subject: | |||
LOOK AT THAT ELSIF STATMENT. your code is completly bassakwards, . if htey enter 1 then its gonna have a true statement ,meaning that it will exit the loop NOT HTE IF STATEMENT, you cant exit an if statement with the exit command you need somthing to be true , so not only by entering one does it get out of hte if statement it also gets out of your loop, so hte program finishes , what you need is to add another loop from the first line to the last line so that it will loop back to the tp of the program again. |
Author: | shorthair [ Wed Jan 07, 2004 11:27 am ] |
Post subject: | |
FULLY WORKING VERSION OF YOUR PROGRAM ***I edited out this old version of the code so that the forum dosent look messey and huge*** |
Author: | Angel [ Wed Jan 07, 2004 11:39 am ] |
Post subject: | |
Thanks! But no offence... you dun gotta be rude about it! I'm merely a newbe trying to make it in this huge and complicated world of Turing! ![]() |
Author: | shorthair [ Wed Jan 07, 2004 11:41 am ] |
Post subject: | |
sorry , but to me it just loked so obvious , im judging it from experiance , sorry about hte comment , ![]() |
Author: | Angel [ Wed Jan 07, 2004 12:39 pm ] |
Post subject: | |
Thanks, and no hard feelings ![]() |
Author: | Angel [ Wed Jan 07, 2004 12:41 pm ] |
Post subject: | |
I've run into another problem. I tried the program you posted and it works, but when I editted it a bit (I added questions for the second quiz), it shows me an error that says: Extra 'end' So when I delete the end loop the program works again, but it's like the problem I was having before: nothing happens when the user puts in the correct number. I'll paste the program again and please see if you can modify it again to display the correct result. Thanks. : ![]() |
Author: | shorthair [ Wed Jan 07, 2004 12:51 pm ] |
Post subject: | |
Let me have this one guys , il have it up in 1 hour okay , thanks |
Author: | Angel [ Wed Jan 07, 2004 12:52 pm ] |
Post subject: | |
A whole hour?! But I can wait... as long as I can finally get it to work! ![]() |
Author: | Angel [ Wed Jan 07, 2004 2:03 pm ] |
Post subject: | |
Almost done? |
Author: | shorthair [ Wed Jan 07, 2004 2:09 pm ] |
Post subject: | |
here ya go ![]() |
Author: | shorthair [ Wed Jan 07, 2004 2:10 pm ] |
Post subject: | |
fully done , changes the entire method you did it, please ask questions so that you really understand this , dont just say you know it if you dont |
Author: | shorthair [ Wed Jan 07, 2004 2:12 pm ] |
Post subject: | |
I only actually needed literally 3 minutes , but i had to go out , i changed aabout 20 lines of code , and made procedures out of the quizes , sorry about the delay |
Author: | Angel [ Wed Jan 07, 2004 2:13 pm ] |
Post subject: | |
![]() ![]() |
Author: | shorthair [ Wed Jan 07, 2004 2:14 pm ] |
Post subject: | |
Did you get the source yet -----> its on hte next page |
Author: | shorthair [ Wed Jan 07, 2004 2:14 pm ] |
Post subject: | |
OKAY COMPSCI TIMED OUT AND SAID IT DIDNT POST BUT THE SAME CODE GOT POSTER 2 TIMES , JUST EDITING IT OUT |
Author: | shorthair [ Wed Jan 07, 2004 2:15 pm ] |
Post subject: | |
iS THERE ANY WAY TO DELETE REPLYS , BECASUE THERE ARE ALOT THAT COULD BE REMOVED FROM THIS FORUM TOPIC |
Author: | shorthair [ Wed Jan 07, 2004 2:15 pm ] |
Post subject: | |
no problem |
Author: | shorthair [ Wed Jan 07, 2004 2:16 pm ] |
Post subject: | |
its to much , edit your last messages and take the code out so this forum isnt so big , DO IT FAST |
Author: | Angel [ Wed Jan 07, 2004 2:29 pm ] |
Post subject: | |
It worked! You're amazing! Thank you so much! Now all I have left to do is make a table of scores and I should be finished! OMG! I can't thank you enough! THANK YOU SOOOO MCUH!!! Without you, I would have failed this ISP! ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Author: | shorthair [ Wed Jan 07, 2004 2:33 pm ] |
Post subject: | |
Please edit out your last posts so that all that source is gone apart from the one i posted, no problem , were here to help eacho other , but thank you for apreciating my help ..... do you fully understand the code? |
Author: | shorthair [ Wed Jan 07, 2004 2:36 pm ] |
Post subject: | |
Who gave you those 100 bits angel , they just appeared outta nowhere |
Author: | Angel [ Wed Jan 07, 2004 3:49 pm ] |
Post subject: | |
Yeah that tends to happen a lot. I get bits from nowhere. I'm not sure how that works. Umm.. I do fully understand the program though! ![]() ![]() ![]() |
Author: | shorthair [ Wed Jan 07, 2004 4:40 pm ] | ||
Post subject: | |||
LATEST VERSION ![]()
|
Author: | Angel [ Wed Jan 07, 2004 5:00 pm ] | ||
Post subject: | |||
Your program works alone, but when combined with mine, it doesn't. It's because I'm not sure where to put the loop. Here's a piece of my exact program:
|
Author: | shorthair [ Wed Jan 07, 2004 5:02 pm ] |
Post subject: | |
i already made exit statments you dont need those |
Author: | Angel [ Wed Jan 07, 2004 5:04 pm ] |
Post subject: | |
Those are the exit statement you made. I took out the loop though because when I entered the number of teh quiz, it looped again, and then it finally went to the quiz. |
Author: | shorthair [ Wed Jan 07, 2004 5:05 pm ] |
Post subject: | |
i need the font variable |
Author: | Angel [ Wed Jan 07, 2004 5:07 pm ] | ||
Post subject: | |||
and you know the rest of the code |
Author: | shorthair [ Wed Jan 07, 2004 5:11 pm ] | ||
Post subject: | |||
okay now its all done using your code and your fonts and everything just change the font to what you want , this is fully done
|
Author: | Angel [ Wed Jan 07, 2004 5:12 pm ] |
Post subject: | |
The problem is that when you type in a few wrong answers and then the right one, it goes again... ![]() |
Author: | shorthair [ Wed Jan 07, 2004 5:13 pm ] |
Post subject: | |
dude ive rewritten your program like 9 times , i definatly want hte bits after this one, now tell me what this new problem is |
Author: | Angel [ Wed Jan 07, 2004 5:16 pm ] | ||
Post subject: | |||
Like I said, I'll give you ALL my bits I promise... ok, I posted the font codes on the second page. Now, when the user types in the wrong choice, and then they type in the right one, the program reruns... it asks them to type in a choice again. Here's the code that's giving me trouble:
|
Author: | shorthair [ Wed Jan 07, 2004 5:18 pm ] | ||
Post subject: | |||
HERE IS HTE FULL PROGRAM WORKING WITH YOUR VARIABLE JUST CHANGE THE FONT SETTINGS AND HTE FIRST LOCATE
|
Author: | shorthair [ Wed Jan 07, 2004 5:41 pm ] |
Post subject: | |
.... what do you mean the 2 programs dont mix ..... you cant just give me half the code ..... ive been working here for you for about 6 hours and now you bring it up , ehy didnt you give me all hte code , you cant just and new code and hope it works |
Author: | Angel [ Wed Jan 07, 2004 5:49 pm ] | ||
Post subject: | |||
Don't worry, it's all good. I just have one question. For this part of the code:
When the user enters "y" or "Y" at the end of whichever quiz, where is the command which directs the program on what to do? |
Author: | shorthair [ Wed Jan 07, 2004 5:50 pm ] |
Post subject: | |
there isnt one , if the answer isnt no , it reruns the loop ( which is the begining of hte program) if it is = to n then it exits that main loop and ends the program WHERE ARE THE BITS |
Author: | shorthair [ Wed Jan 07, 2004 5:51 pm ] |
Post subject: | |
FINALLY WE HAVE FINISHED THIS NEVER ENDING PROGRAM |
Author: | Angel [ Wed Jan 07, 2004 5:52 pm ] |
Post subject: | |
No, THANK YOU!!! ![]() |
Author: | shorthair [ Wed Jan 07, 2004 5:56 pm ] |
Post subject: | |
DID YOU GET YOUR CODE TO MIX WITH THE NEW CODE , OR DO I HAVE TO DO ANY LAST MINUTE ADJSTMENTS |
Author: | Angel [ Wed Jan 07, 2004 5:59 pm ] |
Post subject: | |
I'll get it I'll get it... I hope ![]() |
Author: | shorthair [ Wed Jan 07, 2004 6:04 pm ] |
Post subject: | |
okay send everything to my email address and il work out any last minute bugs for you , ive got a lazy night after hockey , so you can count on me to have it done , im only using code that you understand , this program could be about 100 lines shorther minimum but im not about to help you cheat , but becuse of your circumstances and that you ave been willing to learn , i dont mind finishing it up for you Email : ark_angel3@hotmail.com |
Author: | Angel [ Wed Jan 07, 2004 6:07 pm ] |
Post subject: | |
I LOVE YOU! You've been a great help... I'll continue trying to figure it out and I'll send you the file a bit later... Have fun at hockey! ![]() |
Author: | shorthair [ Wed Jan 07, 2004 6:58 pm ] |
Post subject: | |
have 15 BITS for being hot ![]() |