Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports Microsoft.VisualBasic.CompilerServices
- Module Module1
- Public Class GodisnjeDoba
- Structure Godina
- Dim mjesec As String
- Dim temperatura As Integer
- End Structure
- Function Punjenje(ByRef unos As Godina())
- Dim random1 As Random = New Random()
- For i As Integer = 0 To unos.GetUpperBound(0)
- Console.Write("Unesite ime mjeseca: ")
- unos(i).mjesec = Console.ReadLine()
- unos(i).temperatura = random1.Next(-1, 30)
- Console.WriteLine()
- Next
- Console.WriteLine()
- Return 0
- End Function
- Sub Ispis(ByRef struktura As Godina())
- For Each ulaz In struktura
- Console.WriteLine("MJESEC: {0} TEMPERATURA: {1}", ulaz.mjesec, ulaz.temperatura)
- Next
- Console.WriteLine()
- End Sub
- Sub MaxIspis(ByRef max As Integer)
- For i As Integer = 1 To max
- Console.Write("*" & " ")
- Next
- Console.WriteLine()
- End Sub
- Function MaxTemp(ByRef max As Integer, ByRef temperatura As Godina()) As Integer
- max = temperatura(0).temperatura
- For i As Integer = 0 To temperatura.GetUpperBound(0)
- If temperatura(i).temperatura > max Then
- max = temperatura(i).temperatura
- End If
- Next
- Console.WriteLine()
- Return max
- End Function
- End Class
- Sub Main()
- Dim pozivKlase As GodisnjeDoba = New GodisnjeDoba()
- Dim pozivStrukture As GodisnjeDoba.Godina() = New GodisnjeDoba.Godina(2) {}
- Dim max As Integer
- Console.WriteLine("Molimo vas unesite iduće podatke")
- Console.WriteLine()
- pozivKlase.Punjenje(pozivStrukture)
- Console.WriteLine()
- pozivKlase.Ispis(pozivStrukture)
- Console.WriteLine()
- pozivKlase.MaxTemp(max, pozivStrukture)
- Console.WriteLine()
- pozivKlase.MaxIspis(max)
- Console.ReadKey()
- End Sub
- End Module
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement