Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Storage Program Bugs
Index -> Programming, Visual Basic and Other Basics -> Visual Basic Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
LasersGoPew




PostPosted: Wed Dec 13, 2006 2:07 pm   Post subject: Storage Program Bugs

Allright so im doing my next assignemnt and its giving me a few problems cause i cant find any notes on it. The first problem is that i have no idea how to sort from highest to lowest when you press show marks. Secondly when you press cancel on the input how many makrs you want to process box it bugs I also dont know how to fix that. Also any bugs you guys find could you please tell me.
Thanks.
code:

Dim MARKS(1 To 34) As Integer
Dim Avg As Integer
Dim numberofmarks As Integer
Dim SORTED As Boolean
Dim TEMP As Integer

Private Sub cmdA_Click()
Form1.Cls
Sum = 0
For I = 1 To numberofmarks
Sum = Sum + MARKS(I)
Next I
Avg = Sum / numberofmarks
Print Avg
End Sub

Private Sub cmdB_Click()
Form1.Cls
BIG = 0
For I = 1 To 34
If MARKS(I) > BIG Then
BIG = MARKS(I)
End If
Next I
Print BIG
End Sub

Private Sub cmdDone_Click()
End
End Sub
Private Sub cmdW_Click()
Form1.Cls
SMALL = 100
For I = 1 To numberofmarks
If MARKS(I) < SMALL Then
SMALL = MARKS(I)
End If
Next I
Print SMALL
End Sub

Private Sub cmdS_Click()
Form1.Cls
SORTED = True
Do While SORTED = False
For x = 1 To numberofmarks
If MARKS(x) > MARKS(x + 1) Then
TEMP = MARKS(x)
MARKS(x) = MARKS(x + 1)
MARKS(x + 1) = TEMP
SORTED = False
End If
Next x
SORTED = True
Loop
For J = 1 To numberofmarks
Print MARKS(J)
Next J

End Sub

Private Sub Form_Load()

numberofmarks = InputBox("Enter the number of Marks you Want to Process.")
For I = 1 To numberofmarks
MARKS(I) = InputBox("Enter a Mark", "")
Next I

End Sub



The Extension 'exe' was deactivated by an board admin, therefore this Attachment is not displayed.

Sponsor
Sponsor
Sponsor
sponsor
cool dude




PostPosted: Wed Dec 13, 2006 3:21 pm   Post subject: (No subject)

stop posting as exe and please indent. i'm not looking at your code until you indent it. all i can tell you without looking at your code is to use a sorting algorithm to sort from highest to lowest. the easiest to code is bubble sort. ever heard of bubble sort?
peterggmss




PostPosted: Wed Jan 10, 2007 6:50 pm   Post subject: RE:Storage Program Bugs

Hello, did you figure it out? I'm going to have to get my done tonight or I'll get zero Sad.
Silent Avenger




PostPosted: Wed Jan 10, 2007 8:34 pm   Post subject: Re: Storage Program Bugs

Well If you need any tips go here http://en.wikipedia.org/wiki/Bubble_sort which will explain anything and then if you need more help just ask.
Display posts from previous:   
   Index -> Programming, Visual Basic and Other Basics -> Visual Basic Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: