Вы находитесь на странице: 1из 3

Sub Main()

Dim Cid(19) As Integer


Dim cdigit As Integer
Dim Name(19) As String
Dim age(19) As Integer
Dim Pb(19) As Single
Dim noofruns(19) As Integer
Dim Cd(3) As Integer
Dim A As Integer
Dim numofruns(19) As Integer
Dim n As Integer = 0
Dim j As Integer = 0
Dim y As Integer = 1
Dim x As Integer = 0
Dim b As Integer = 0
Dim cage As Integer
Dim minage As Integer = 4
Dim maxage As Integer = 14
Dim Id As Integer = 481
Dim PID As Integer
Dim REGISTERID(19) As Integer
Dim REGISTER As Boolean
Dim check As Char
Dim shour, smin, ssec, fhour, fmin, fsec, sduration, fduration As Integer
Dim con As Char
Dim duration As Integer
Dim fast4 As Integer = 0
Dim fast7 As Integer = 0
Dim fast11 As Integer = 0
Dim n4, n7, n11 As String
For count = 0 To 19
j = 1
y = Id
Do While y >= 1
A = y Mod 10
y = y / 10
Cd(j) = A
j = j + 1
Loop
cdigit = Cd(3) * 4 + Cd(2) * 3 + Cd(1) * 2
cdigit = cdigit Mod 10
cdigit = 10 - cdigit
Cid(x) = (Id * 10) + cdigit

Console.WriteLine("enter child age ")


cage = Console.ReadLine
Do While cage < minage Or cage > maxage
Console.WriteLine("age must be betweeen 4 and 14 . re-enter")
cage = Console.ReadLine
Loop
age(x) = cage
Console.WriteLine("enter child name ")
Name(x) = Console.ReadLine
Pb(x) = 0
noofruns(x) = 0

Console.WriteLine("The Child is regsitered with id " & Cid(x) & " with the
age is" & age(x) & " And The Name of a child is " & Name(x))
x = x + 1
Id = Id + 1
Next count

Do
For R = 0 To 19
REGISTERID(R) = 0
Next
Do

Console.WriteLine("ENTER THE PARTICIPANT ID")


PID = Console.ReadLine
Do
If PID = Cid(n) Then
REGISTER = True
Else
REGISTER = False
n = n + 1
End If
Loop Until A = 20 Or REGISTER = True

If REGISTER = True Then


If PID = REGISTERID(n) Then
Console.WriteLine("you have already taken part in the event")
Else
REGISTERID(n) = PID
End If
Else
Console.WriteLine("you are not registered")

End If
Console.WriteLine("Do you want to add more participant y/n")
check = Console.ReadLine
Loop Until check = "n"
For time = 0 To 19
If REGISTERID(time) <> 0 Then
Console.WriteLine("enter start hour")
shour = Console.ReadLine
Console.WriteLine("enter start minute")
smin = Console.ReadLine
Console.WriteLine("enter start second")
ssec = Console.ReadLine
sduration = (shour * 3600) + (smin * 60) + ssec
Console.WriteLine("enter finish hour")
fhour = Console.ReadLine
Console.WriteLine("enter finsih minute")
fmin = Console.ReadLine
Console.WriteLine("enter finish second")
fsec = Console.ReadLine
fduration = (fhour * 3600) + (fmin * 60) + fsec
duration = fduration - sduration
If duration > Pb(time) Then Pb(time) = duration
noofruns(time) = noofruns(time) + 1
End If

Next

Console.WriteLine("any more event")


con = Console.ReadLine
Loop Until con = "y"
For run = 0 To 19
If noofruns(run) = 11 Then
Console.WriteLine("half wrist band awarded to " & Name(run))
ElseIf noofruns(run) = 22 Then
Console.WriteLine("full wrist band awarded to" & Name(run))

End If
If age(run) >= 4 And age(run) <= 6 Then
If Pb(run) > fast4 Then
fast4 = Pb(run)
n4 = Name(run)
End If
ElseIf age(run) >= 7 And age(run) <= 10 Then
If Pb(run) > fast7 Then
fast7 = Pb(run)
n7 = Name(run)
End If

ElseIf age(run) >= 7 And age(run) <= 10 Then


If Pb(run) > fast11 Then
fast11 = Pb(run)
n11 = Name(run)
End If

End If
Next
Console.WriteLine("the fastest child in the category of 4 to 6 is" & n4 & "And
His Time is " & fast4)
Console.WriteLine("the fastest child in the category of 7 to 10 is" & n7 & "And
His Time is " & fast7)
Console.WriteLine("the fastest child in the category of 11 to 14 is" & n11 & "And
His Time is " & fast11)
Console.ReadKey()

End Sub

Вам также может понравиться