Skip to content

Commit

Permalink
мердж нулаблес
Browse files Browse the repository at this point in the history
nullable handling
  • Loading branch information
flovnes authored Apr 27, 2024
2 parents c2255b0 + fd827e9 commit dd86a02
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 22 deletions.
2 changes: 1 addition & 1 deletion src/lab4.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>disable</Nullable>
<Nullable>enable</Nullable>
</PropertyGroup>

</Project>
44 changes: 23 additions & 21 deletions src/main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,41 @@ static List<Student> ReadData(string fileName) {
List<Student> students = [];
try {
StreamReader reader = new(fileName);
string line;
while ((line = reader.ReadLine()) != null) {
Student student = new(line);
students.Add(student);
}
string? line;
while ((line = reader.ReadLine()) != null)
students.Add(new(line));
}
catch (DirectoryNotFoundException) { Console.WriteLine($"\n\nno input\n\n"); }
catch (IOException e) { Console.WriteLine($"idk -> {e.Message}"); }
return students;
}

static void RunMenu(List<Student> students) {
int match;
int match;
do {
Console.WriteLine("Виберіть варіант форматування\nПопов Антон [1]\nВолощук Влад [2]\nДмитро Киба [3]\nНомер > ");
match = int.Parse(Console.ReadLine());
Console.Write("\n<- Вихід [0]\nВиконати варіант 9 студента Попов Антон [1]\nВиконати варіант 10 студента Дмитро Киба [2]\nВиконати варіант 24 студента Волощук Влад [3]\nНомер > ");
string? s = Console.ReadLine();
if (int.TryParse(s, out match)) {
switch (match) {
case 1:
Var9(students);
break;
case 2:
Var10(students);
break;
case 3:
Var24(students);
break;
default:
Console.WriteLine("Немає такого варіанту.");
break;
case 1:
Var9(students);
break;
case 2:
Var10(students);
break;
case 3:
Var24(students);
break;
case 0:
break;
default:
Console.WriteLine("Немає такого варіанту.");
break;
}
}
} while (match != 0);
}


static void Main() {
Console.OutputEncoding = UTF8Encoding.UTF8;
List<Student> students = ReadData("../input.txt");
Expand Down

0 comments on commit dd86a02

Please sign in to comment.