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