Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.IO;
- namespace ConsoleApplication2
- {
- struct SStudent
- {
- public string name;
- public int number, math, eng, philosophy;
- public SStudent (string name, int number, int math, int eng, int philosophy)
- {
- this.name = name;
- this.number = number;
- this.math = math;
- this.eng = eng;
- this.philosophy = philosophy;
- }
- public void Show()
- {
- Console.WriteLine("{0}; {1};\n\tматанализ: {2}\n\tангл.яз: {3}\n\tфилософия: {4}", name, number, math, eng, philosophy);
- }
- public bool Check()
- {
- if (math < 3 || eng <3 || philosophy <3)
- return false; else return true;
- }
- }
- class Program
- {
- static void Main(string[] args)
- {
- using (StreamReader input = new StreamReader("e:/practice/input.txt", Encoding.GetEncoding(1251)))
- {
- int n = int.Parse(input.ReadLine());
- SStudent [] array = new SStudent[n];
- for (int i = 0; i < n; i++)
- {
- string [] tmp = input.ReadLine().Split(',');
- array[i].name = tmp[0];
- array[i].number = int.Parse(tmp[1]);
- array[i].math = int.Parse(tmp[2]);
- array[i].eng = int.Parse(tmp[3]);
- array[i].philosophy = int.Parse(tmp[4]);
- }
- using (StreamWriter output = new StreamWriter("e:/practice/output.txt", false))
- {
- var Survivalists =
- from x in array
- where x.Check()
- orderby x.number
- select x;
- foreach (var x in Survivalists)
- output.WriteLine("{0}; {1};\n\tматанализ: {2}\n\tангл.яз: {3}\n\tфилософия: {4}", x.name, x.number, x.math, x.eng, x.philosophy);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement