Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace ConsoleApplication1
- {
- class Program
- {
- public struct varosok
- {
- public string varos;
- public int homerseklet;
- }
- static void Main(string[] args)
- {
- List<varosok> lista = new List<varosok>();
- varosok varos = new varosok();
- string[] varostomb = new string[5] { "Miskolc", "Debrecen", "Zalaegerszeg", "Budapest", "Eger"};
- int[] hotomb = new int[5] { -6, -15, -4, 10, 5};
- for (int i = 0; i < varostomb.Length; i++ )
- {
- varos.varos = varostomb[i];
- varos.homerseklet = hotomb[i];
- lista.Add(varos);
- }
- int min = 0, max = 0;
- for (int i = 0; i < lista.Count; i++ )
- {
- Console.WriteLine("{0} {1}", lista[i].varos, lista[i].homerseklet);
- }
- for (int j = 0; j < lista.Count; j++ )
- {
- if (lista[j].homerseklet < lista[min].homerseklet)
- {
- min = j;
- }
- else if (lista[j].homerseklet > lista[max].homerseklet)
- {
- max = j;
- }
- }
- Console.WriteLine("A leghidegebb város: {0}", lista[min].varos);
- Console.WriteLine("A legmelegebb város: {0}", lista[max].varos);
- Console.WriteLine("A minimum hőmérséklet: {0}", hotomb.Min());
- Console.WriteLine("A maximum hőmérséklet: {0}", hotomb.Max());
- Console.WriteLine("A hőmérsékletek átlaga: {0}", (double)hotomb.Average());
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement