//-------------------------------------------- static void Skaityti(string fv, Kelias[] K, out int n) { using (StreamReader reader = new StreamReader(fv)) { string line; int i = 0; while ((line = reader.ReadLine()) != null && (i < Cn)) { string[] parts = line.Split(';'); string pavadinimas = parts[0]; double ilgis = double.Parse(parts[1]); int greitis = int.Parse(parts[2]); K[i++] = new Kelias(pavadinimas, ilgis, greitis); } n = i; } }
static void Main(string[] args) { Kelias[] K = new Kelias[Cn]; int n; Skaityti(CFd, K, out n); //Console.WriteLine("{0}", n); //for (int i = 0; i < n; i++) //{ // Console.WriteLine("{0,5:f2}", K[i].ImtiIlgi()); //} if (File.Exists(CFd)) { File.Delete(CFrez); } SpausdintiDuomenis(CFrez, K, n); }