Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static int[,] OdczytajMacierz(string nazwa)
- {
- StreamReader sr = null;
- int licznik = 0;
- sr = new StreamReader(nazwa);
- while (!sr.EndOfStream)
- {
- sr.ReadLine();
- licznik++;
- }
- sr.Close();
- sr = new StreamReader(nazwa);
- string pomocniczy = sr.ReadLine();
- sr.Close();
- string[] tablicapomocnicza = pomocniczy.Split(' ');
- int[,] tablica = new int[licznik, tablicapomocnicza.Length];
- sr = new StreamReader(nazwa);
- int k = 0;
- for (int i = 0; i < tablica.GetLength(0); i++)
- {
- k = 0;
- pomocniczy = sr.ReadLine();
- tablicapomocnicza = pomocniczy.Split(' ');
- for (int j = 0; j < tablica.GetLength(1); j++)
- {
- tablica[i, j] = Convert.ToInt32(tablicapomocnicza[k]);
- k++;
- }
- }
- return tablica;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement