Advertisement
Guest User

Untitled

a guest
Jan 20th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 2.53 KB | None | 0 0
  1. Imports Microsoft.VisualBasic.CompilerServices
  2.  
  3. Module Module1
  4.  
  5.     Public Class GodisnjeDoba
  6.  
  7.         Dim i As Integer = 11
  8.  
  9.         Structure Godina
  10.             Dim mjesec As String
  11.             Dim temperatura As Integer
  12.         End Structure
  13.  
  14.         Function Punjenje(ByRef unos As Godina())
  15.  
  16.             For j As Integer = 0 To unos.GetUpperBound(0)
  17.                 Console.Write("Unesite ime mjeseca: ")
  18.                 unos(i).mjesec = Console.ReadLine()
  19.                 Console.Write("Unesite temperaturu u mjesecu {0} : ", unos(i).mjesec)
  20.                 unos(i).temperatura = Console.ReadLine()
  21.             Next
  22.             Console.WriteLine()
  23.             Return 0
  24.         End Function
  25.  
  26.     End Class
  27.  
  28.     Sub Main()
  29.  
  30.         Dim pozivKlase As GodisnjeDoba = New GodisnjeDoba()
  31.         Dim pozivStrukture As GodisnjeDoba.Godina() = New GodisnjeDoba.Godina(11) {}
  32.         Dim max As Integer
  33.  
  34.         Console.WriteLine("Molimo vas unesite iduće podatke")
  35.         Console.WriteLine()
  36.  
  37.         pozivKlase.Punjenje(pozivStrukture)
  38.  
  39.         'For i As Integer = 0 To pozivStrukture.GetUpperBound(0)
  40.         '    Console.WriteLine("Unesite ime mjeseca")
  41.         '    pozivStrukture(i).mjesec = Console.ReadLine()
  42.         '    Console.WriteLine("Unesite temperaturu {0}. mjeseca", i + 1)
  43.         '    pozivStrukture(i).temperatura = Console.ReadLine()
  44.         'Next
  45.  
  46.  
  47.         For Each ulaz In pozivStrukture
  48.             Console.WriteLine("MJESEC: {0}   TEMPERATURA: {1} C", ulaz.mjesec, ulaz.temperatura)
  49.         Next
  50.  
  51.  
  52.         'For i As Integer = 0 To pozivStrukture.GetUpperBound(0)
  53.         '    For j As Integer = 0 To pozivStrukture.GetUpperBound(0) - 1
  54.         '        If pozivStrukture(j).temperatura < pozivStrukture(j + 1).temperatura Then
  55.         '            Dim temp As Integer = pozivStrukture(j).temperatura
  56.         '            pozivStrukture(j).temperatura = pozivStrukture(j + 1).temperatura
  57.         '            pozivStrukture(j + 1).temperatura = temp
  58.         '        End If
  59.         '    Next
  60.         'Next
  61.  
  62.         max = pozivStrukture(0).temperatura
  63.         For i As Integer = 1 To pozivStrukture.GetUpperBound(0)
  64.  
  65.  
  66.             Console.WriteLine()
  67.  
  68.             If pozivStrukture(i).temperatura > max Then
  69.                 max = pozivStrukture(i).temperatura
  70.             End If
  71.         Next
  72.         Console.WriteLine()
  73.  
  74.         For i As Integer = 1 To max
  75.             Console.Write("*" & " ")
  76.         Next
  77.         Console.WriteLine()
  78.  
  79.  
  80.         Console.ReadKey()
  81.     End Sub
  82. End Module
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement