Page 1 of 1

Search for highest bid

Posted: Wed Nov 17, 2004 4:00 pm
by Kathy Nevin
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.

Posted: Thu Nov 18, 2004 5:04 am
by Dr_Davenstein
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. ;)