Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

going from one loop to another, newbie here.

going from one loop to another, newbie here.

going from one loop to another, newbie here.

I'm taking qbasic in school and we have to write a pice of software that manages an auction. Pretty much we're free to be creative and do what we want as long as the software works and you could be a complete idiot and not screw the program up. Right now it starts out fine, but has trouble in the middle. I have it ask for the name of the item, the starting price, the first bid which i made a do until loop so that the first bid has to be greater than the starting price, that works all fine....but then i want it to go to 'next bid' and only accept bids that are higher than the previous high bid. It jumps immediatly from after you enter a valid number for the 'first bid' to what i want it to do at the end....say the high bid, ask for the high-bidders name, and then say '(name) has won the (item)'

here is the code i have so far, if you can tell me what i'm doing wrong i would appreciate it bigtime. I want to get one step ahead in the class, and if i could bring in a stable and pretty reliable program on monday i would be happy.


PRINT "To stop auction, enter 0"
PRINT "Enter name of item "
INPUT item$
PRINT "Enter starting price: "
INPUT minn

DO UNTIL low > minn
PRINT "Enter first bid: "

DO UNTIL bid = 0
PRINT "Enter next bid"
IF bid > min THEN bid = min
IF bid < min THEN bid = invalid
IF bid > min THEN bid = max

PRINT "High bid: "; max
PRINT "Enter name of high bidder: "
INPUT name$
PRINT name$; " has won the "; item$

RE: going from one loop to another, newbie here.

Your second loop "DO until bid=0" starts with bid equaling 0 because it's never defined or input so that loop would seem to be ignored in effect.

I would suggest, inputing the bid one time right before the
second do loop. That way, bid will have something to start with then if it is zero it will go to the "AUCTION ENDED"

otherwise it will loop and ask again for another bid.

There are other ways to do it, but that would be the simplest modification for the program you have.

i.e. have an input for the bid in addition to the input for the bid within the do loop.
change the loop to:

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close