Thread View: be.comp.programming
1 messages
1 total messages
Started by Christian
Sun, 17 Nov 2002 19:58
visual basic
Author: Christian
Date: Sun, 17 Nov 2002 19:58
Date: Sun, 17 Nov 2002 19:58
116 lines
3363 bytes
3363 bytes
Hallo,
Wanneer ik de code van hieronder laat werken, dan wordt er mij eerst
gevraagd hoeveel kinderen er zijn, bv 5.
Daarna wordt mij gevraagd uit hoeveel lettergrepen het versje bestaat, bv 4.
Hierna wordt me door het programma meegedeeld welk kind er over blijft. Op
deze manier : kind 1, 2, 3 en 4 vald af. Het programma begint opnieuw te
tellen vanaf 5. 5, 1, 2 en 3 vald af enz... tot wanneer kind 1 over blijft.
Dit begrijp ik allemaal wel, maar niet wat er zich nu juist in de code
afspeeld. Vooral niet in het stuk : 'simulatie van het aftelrijmpje
Is er iemand die me dit kan uitleggen aub? En vooral waarvoor deze
variabelen staan : bytPointKind, bytPointLetter.
Alvast bedankt,
Christian.
Sub Main()
'declaratie van een aantal hulpvariabelen
Dim bytAantSnoep, bytAantKindStart, bytAantLetter As Byte
Dim bytPointKind, bytPointLetter As Byte
'opvragen van het aantal kinderen
Console.Write("hoeveel kinderen : ")
bytAantSnoep = Console.ReadLine()
bytAantKindStart = bytAantSnoep
'declaratie van de tabel
Dim tblTabel(bytAantSnoep - 1) As Byte
'opvragen van het aantal lettergrepen
Console.Write("hoeveel lettergrepen : ")
bytAantLetter = Console.ReadLine()
'simulatie van het aftelrijmpje
Do While bytAantSnoep > 1
bytPointLetter = 0
Do Until bytPointLetter = bytAantLetter
bytPointLetter += 1
Do
If bytPointKind > bytAantKindStart - 1 Then
bytPointKind = 1
Else
bytPointKind += 1
End If
Loop Until tblTabel(bytPointKind - 1) = 0
Loop
tblTabel(bytPointKind - 1) = 1
bytAantSnoep -= 1
Console.WriteLine("kind " & bytPointKind & " is 'af'")
Loop
'afdrukken van het 'overgebleven' kind
For bytPointKind = 1 To bytAantKindStart
If tblTabel(bytPointKind - 1) = 0 Then _
Console.WriteLine("kind " & bytPointKind & " is 'over'")
Next
Console.ReadLine()
End Sub
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads