half dollars: 1
these are the results. But this only adds up to 91 cents. I'm missing 3 pennies.
here's the code
Private Sub change_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles change.Click Dim shrhalfdollars, shrquarters, shrdimes, shrnickels, shrpennies, shrchange As Short shrchange = 100 - sale.Value If shrchange >= 50 Then shrhalfdollars = 1 shrchange = shrchange - 50 End If If shrchange >= 25 Then shrquarters = 1 shrchange = shrchange - 25 End If If shrchange >= 10 Then shrdimes = 1 shrchange = shrchange - 10 End If If shrchange >= 5 Then shrnickels = 1 shrchange = shrchange - 5 End If If shrchange >= 1 Then shrpennies = 1 shrchange = shrchange - 1 End If halfdollars.Text = shrhalfdollars quarters.Text = shrquarters dimes.Text = shrdimes nickels.Text = shrnickels pennies.Text = shrpennies End Sub
I know the dimes and pennies shouldn't equal 1 but if i use a do while for the dimes and pennies the program freezes.
here is what i had for the do while. (everything is the same in the code except for the dimes and pennies)
Do While shrchange >= 10 shrdimes = 0 shrchange = shrdimes + 1 Loop Do While shrchange >= 1 shrpennies = 0 shrchange = shrpennies + 1 Loop
any assistance would be greatly appreciated!
This post has been edited by jake_98gt: 30 November 2006 - 12:12 AM