Search for highest bid

Please use this Board for QBasic related requests ( file research, programming, etc.)

Moderators:Administrator, Global Moderator

Post Reply
Kathy Nevin
Newbie
Posts:1
Joined:Wed Nov 17, 2004 3:46 pm
Contact:
Search for highest bid

Post by Kathy Nevin » Wed Nov 17, 2004 4:00 pm

I'm doing a program for QBasic class and part of the assignment (for extra credit) is to find the highest bid in a table and put an "*" after it.

Can someone point me in the right direction? I tried sorting them so the highest bid was the last in the column, but how can I get the "*" to print after it. And is there a way to find the highest bid without sorting them?

Any help would be greatly appreciated.

Dr_Davenstein
QBasic God
Posts:166
Joined:Tue Mar 25, 2003 12:45 am
Location:U.S.A.
Contact:

Post by Dr_Davenstein » Thu Nov 18, 2004 5:04 am

Yeah, you don't really need to sort them just to print an asterisk after the highest one. You could do something like this...

Code: Select all

HiBid%=-32000
For S%=1 to TotalBids%
 If Bid%(S%)>HiBid% then 
  HiBid%=Bid%(S%)
  Marker%=S%
 End If
Next

For S%=1 to TotalBids%

Text1$=Str$(Bid%(S%))

 If S%=Marker% then 
  Text2$="*"
 Else
   Text2$=""
 End If

Locate S%,1
Print Text1$ + Text2$

Next
You'll have to modify the variables to fit your program though. ;)
Come check out [url=http://www.freebasic.net/forum/index.php]FreeBASIC[/url]. The syntax is based on QuickBasic, but it expands to use pointers, operator overloading, etc... The list goes on and on!

Post Reply