add Programmyday form github

This commit is contained in:
Ruben Kallinich
2024-07-25 15:47:46 +02:00
parent 09c8eab938
commit 7362c3d7ce
132 changed files with 3669 additions and 0 deletions

View File

@@ -0,0 +1,80 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Intrinsics.X86;
using System.Text;
using System.Threading.Tasks;
namespace StudentenDatenbank
{
internal class Datenbank
{
private Student[] studenten;
public Datenbank(int anzahl)
{
studenten = new Student[anzahl];
}
public bool AddStudent(Student student)
{
for (int i = 0; i < studenten.Length; i++)
{
if (studenten[i] == null)
{
studenten[i] = student;
return true;
}
}
return false;
}
public bool RemoveStudent(Student student)
{
for (int i = 0; i < studenten.Length; i++)
{
if (studenten[i] == student)
{
studenten[i] = null;
return true;
}
}
return false;
}
public bool RemoveStudent (int martrieklNr)
{
for (int i = 0; i < studenten.Length; i++)
{
if (studenten[i] != null)
{
if (studenten[i].GetMatrikelNr() == martrieklNr)
{
studenten[i] = null;
return true;
}
}
}
return false;
}
public int CountStudents()
{
int cnt = 0;
for (int i = 0; i < studenten.Length; i++)
{
if (studenten[i] != null)
{
cnt++;
}
}
return cnt;
}
public void PrintMe()
{
for (int i = 0; i < studenten.Length; i++)
{
if (studenten[i] != null)
{
studenten[i].PrintMe();
}
}
}
}
}