Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

6 aus 49 mit VB

Empfohlene Antworten

ich soll ein kleines programm entwickeln das (lotterieprogramm) das 6 verschiedene zufallszahlen von 49 erstellt und diese dann noch der größe nach ordnet. kann mir jemand sagen wie ich das machen soll.

Hi,

mal ohne Sortierung und auf die Schnelle hinprogrammiert:

Private Sub Command1_Click()

Dim lotto(6) As Integer

For x = 1 To 6

lotto(x) = 0

Next x

Dim i As Integer

Counter = 1

While Counter < 7

i = zufallszahl

For pruefen = 1 To 6

If lotto(pruefen) = i Then

i = zufallszahl

Counter = Counter - 1

End If

Next pruefen

lotto(Counter) = i

Counter = Counter + 1

Wend

Debug.Print "____________"

For i = 1 To 6

Debug.Print lotto(i)

Next i

Debug.Print "____________"

End Sub

Private Function zufallszahl() As Integer

zufallszahl = Int((49 - 1 + 1) * Rnd + 1)

End Function

Die Sortierung überlass ich mal andere (es empfiehlt sich der Bubblesort http://www.activevb-archiv.de/vb/VBtips/VBtip0187.shtml)

ciaoi

Buell

erst mal danke für die hilfe. vieleicht kann ja irgendjemand anderes was mit dem bubble sort anfangen. es sollen also 6 zahlen zahlen sortiert werden. bubble sort? kann mir jemand sagen wie das funktioniert?:confused:

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Konto

Navigation

Suchen

Suchen

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.