Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Please HELP!! What am I doing wrong.
#1
Hello all,

I am trying to write a program and I seem to have forgotten everything. Here is what I have.

"""""""""""""""""""""""""""""""""""""
PRINT
PRINT "1. PART LOOK UP"
PRINT "2. NEW PART NUMBER"
PRINT "3. VIEW PROJECT SUMMARY"
PRINT
INPUT "PLEASE MAKE A SELECTION"; MAIN.SELECTION$
IF MAIN.SELECTION$ = "1" THEN
GOTO PART.LOOK
END IF
IF MAIN.SELECTION$ = "2" THEN
GOTO NEW.PART
END IF
IF MAIN.SELECTION$ = "3" THEN
GOTO PROJECT.SUMMARY
END IF
GOTO INVALID.ENTRY
"""""""""""""""""""""""""""""""""""

Now, the problem is that no matter what number I entry it wants to jump to the INVALID.ENTRY area.
I have no clue why and don't really have to much time to try and research and find out why. Can someone please help me. I would greatly appreciate it.

Thanks
Chris
Reply
#2
Well, testing that code (and adding sections for each label) it works fine. It's somewhere in the other parts of your program.
i]"I know what you're thinking. Did he fire six shots or only five? Well, to tell you the truth, in all this excitement, I've kinda lost track myself. But being as this is a .44 Magnum ... you've got to ask yourself one question: 'Do I feel lucky?' Well, do ya punk?"[/i] - Dirty Harry
Reply
#3
Here is the whole program code so far.
"""""""""""""""""""""""""""
MAIN.PAGE:
CLS
PRINT
PRINT TAB(25); "PART LOG"
PRINT
PRINT "1. PART LOOK UP"
PRINT "2. NEW PART NUMBER"
PRINT "3. VIEW PROJECT SUMMARY"
PRINT
INPUT "PLEASE MAKE A SELECTION"; MAIN.SELECTION$
IF MAIN.SELECTION$ = "1" THEN
GOTO PART.LOOK
END IF
IF MAIN.SELECTION$ = "2" THEN
GOTO NEW.PART
END IF
IF MAIN.SELECTION$ = "3" THEN
GOTO PROJECT.SUMMARY
END IF
GOTO INVALID.ENTRY

PART.LOOK:
PRINT "WORKS1"

NEW.PART:
PRINT "WORKS2"

PROJECT.SUMMARY:
PRINT "WORKS3"

INVALID.ENTRY:
CLS
PRINT
PRINT "PLEASE ENTER A NUMBER FROM 1-3"
INPUT "PRESS ENTER TO CONTINUE"; CONTINUE$
IF CONTINUE$ = "" THEN
GOTO MAIN.PAGE
END IF
IF CONTINUE$ <> "" THEN
GOTO MAIN.PAGE
END IF
Reply
#4
i've pm'd you the problem, you need to exit the program once you print the result.
i]"I know what you're thinking. Did he fire six shots or only five? Well, to tell you the truth, in all this excitement, I've kinda lost track myself. But being as this is a .44 Magnum ... you've got to ask yourself one question: 'Do I feel lucky?' Well, do ya punk?"[/i] - Dirty Harry
Reply
#5
,,,,,,,,,,,,,,,,
TESTING!!
'''''''''''''''''''''


'''''''''''''''''''''
TESTING!!
,,,,,,,,,,,,,,,,
earn.
Reply
#6
lets say the user enters a one:
the program would route them to part.look
it would then print "works1"
it would immediately carry on into new.part
and print "works2"
it would then go to project.summary
and print "works3"
after that it would goto invalid.entry
and CLS then print the "please enter a number..."
because this happens so fast you never see the works1,works2 stuff. it clears the screen close to 1/100 of a second after it prints the works1,works2. then it prints the statements within the invalid section.




here is an example to show you why it does this

replace your three subs (not including invalid entry)
with the below code:


PART.LOOK:
print "inside PART.LOOK"
PRINT "WORKS1"
sleep
PRINT "moving onto New.part......"


NEW.PART:
print "inside NEW.PART"
PRINT "WORKS2"
sleep
PRINT "moving onto PROJECT.SUMMARY....."

PROJECT.SUMMARY:
PRINT "WORKS3"
sleep
PRINT "moving onto INVALID.ENTRY...."
PRINT "the screen will be ceared"
sleep


perhaps you should use a goto after the each selection to route the user to the end of the program so it doesnnt exexute the other 3 parts after the goto has completed.
if somebody cuts of your hand you still have two sharp bones to stick in thier eyes"
Reply
#7
If you still want to use GOTO instead of SUBs, you could better use GOSUB and RETURN for these type of programs
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)