Advertisement
Guest User

IlIlIlI

a guest
Oct 2nd, 2014
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.51 KB | None | 0 0
  1. using System;
  2.  
  3. namespace chjdrfehrd
  4. {
  5.     class samka
  6.     {
  7.         const int normative = 80;
  8.         public string famile, gr, prepod;
  9.         public bool normat;
  10.         public int rez;
  11.         public samka()
  12.         {
  13.             Console.Write ("фамилия: ");
  14.             this.famile = Console.ReadLine ();
  15.             Console.Write ("группа: ");
  16.             this.gr = Console.ReadLine ();
  17.             Console.Write ("препод: ");
  18.             this.prepod = Console.ReadLine ();
  19.             Console.Write ("результат: ");
  20.             this.rez =int.Parse (Console.ReadLine ());
  21.             if (rez > normative)
  22.                 normat = true;
  23.             else
  24.                 normat = false;
  25.         }
  26.     }
  27.     class MainClass
  28.     {
  29.         public static void Main (string[] args)
  30.         {
  31.             Console.Write ("Количество участниц: ");
  32.             int count = int.Parse (Console.ReadLine ());
  33.             samka[] kross = new samka[count];
  34.             for (int i = 0; i < kross.Length; i++)
  35.             {
  36.                 Console.WriteLine ("Введите данные {0}-й самки", i + 1);
  37.                 kross [i] = new samka ();
  38.             }
  39.             for (int i = 0; i < kross.Length; i++)
  40.             {
  41.                 for (int j = i + 1; j < kross.Length; j++)
  42.                 {
  43.                     if (kross [i].rez > kross [j].rez)
  44.                     {
  45.                         samka temp = kross [i];
  46.                         kross [i] = kross [j];
  47.                         kross [j] = temp;
  48.                     }
  49.                 }
  50.             }
  51.             for (int i = 0; i < kross.Length; i++)
  52.             {
  53.                 Console.WriteLine ("samka: {0} \t group: {1} \t prepod: {2} \t rezult: {3} \t sdal: {4} \n", kross [i].famile, kross [i].gr, kross [i].prepod, kross [i].rez, kross [i].normat);
  54.             }
  55.             Console.ReadKey ();
  56.  
  57.             Console.Read ();
  58.         }
  59.     }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement