Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void Main(string[] args)
- {
- char[] numbers = new char[4] { '2', '3', '4', '5' };
- FileStream fin;
- string s;
- int i;
- try
- {
- fin = new FileStream("test2.txt", FileMode.Open);
- }
- catch (IOException exc)
- {
- Console.WriteLine("Ошибка открытия файла:\n" + exc.Message);
- Console.ReadKey();
- return;
- }
- StreamReader fstr_in = new StreamReader(fin, System.Text.Encoding.GetEncoding(1251));
- try
- {
- while ((s = fstr_in.ReadLine()) != null)
- {
- //Здесь мы парсим строки
- //s - целая строка
- int[,] numbers_pluser = new int[4,20]; // 4 - кол-во предметов 20 - кол-во учеников
- for(int y=0; y < 3; y++)
- {
- //t - один символ из строки
- foreach (var t in s)
- {
- int counterX = 0;
- if (numbers.Contains(t))
- {
- numbers_pluser[counterX, y] = int.Parse(t.ToString());
- counterX += 1;
- }
- }
- }
- }
- }
- catch (IOException exc)
- {
- Console.WriteLine("Ошибка ввода-вывода:\n" + exc.Message);
- }
- finally
- {
- fstr_in.Close();
- }
- Console.ReadLine();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement