Advertisement
Guest User

Untitled

a guest
Nov 12th, 2015
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.85 KB | None | 0 0
  1. public static Parduotuves RastiBrangiausiaGamini(Parduotuves[] par, out int juvelyrikosIndeksas )
  2.         {
  3.             int[] prices = new int[ZiedaiCount];
  4.             int parduotuvesIndeksas = 0;
  5.             juvelyrikosIndeksas = 0 ;
  6.             for (int i = 0; i < par.Length; i++)
  7.                 if (par[i] != null)
  8.                 {
  9.                 for (int j = 0; j < par[i].Gaminys.Length; j++) // ČIA IRGI RODĖ ERRORĄ, BET if (par[i] != null) SUTVARKĖ TAI
  10.  
  11.                 {
  12.                     if (par[i].Gaminys[j].Price >
  13.                     par[parduotuvesIndeksas].Gaminys[juvelyrikosIndeksas].Price)
  14.                     {
  15.                         parduotuvesIndeksas = i;
  16.                         juvelyrikosIndeksas = j;
  17.                     }
  18.                 }
  19.             }
  20.             return par[parduotuvesIndeksas];
  21.         }
  22.  
  23.         public static void SpausdintiZieda(Parduotuves par, int juvelyrikosIndeksas)
  24.         {
  25.                 Console.WriteLine("------------------------------------------");
  26.             Console.WriteLine("Brangiausias ziedas yra " + par.Title + "parduotuveje"); //ERRORĄ RODO ČIA
  27.             Console.WriteLine("------------------------------------------");
  28.             Console.WriteLine("{0,14} {1,10} {2,15} {3,10} {4,6} {5,9} {6,7}", "Manufacturer",
  29.             "Name", "Material", "Weight", "Size", "Hallmark", "Price");
  30.             Console.WriteLine("");
  31.             Console.WriteLine("{0,14} {1,10} {2,13} {3,8} {4,8} {5,7} {6,8}",
  32.             par.Gaminys[juvelyrikosIndeksas].Manufacturer, // 0
  33.             par.Gaminys[juvelyrikosIndeksas].Name, // 1
  34.             par.Gaminys[juvelyrikosIndeksas].Material, // 2
  35.             par.Gaminys[juvelyrikosIndeksas].Weight, // 3
  36.             par.Gaminys[juvelyrikosIndeksas].Hallmark, // 5
  37.             par.Gaminys[juvelyrikosIndeksas].Price); // 6
  38.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement