added date class
This commit is contained in:
parent
593525e53c
commit
5a44a57bee
@ -1,42 +1,56 @@
|
||||
#include "pch.h"
|
||||
#include <iostream>
|
||||
#include <ctime>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
#include <list>
|
||||
#include <string>
|
||||
|
||||
using namespace std;
|
||||
using namespace std;
|
||||
|
||||
class Date
|
||||
{
|
||||
private:
|
||||
short day;
|
||||
short month;
|
||||
unsigned int year;
|
||||
public:
|
||||
Date() : day(1), month(1), year(1900)
|
||||
{
|
||||
|
||||
}
|
||||
Date(short day, short month, unsigned int year) : day(day), month(month), year(year)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class Employee
|
||||
{
|
||||
private:
|
||||
public:
|
||||
Employee(string a_name, string a_first_name, int day, int month, int year) : name(a_name), first_name(a_first_name)
|
||||
Employee(string name, string first_name, short day, short month, unsigned int year) : name(move(name)), first_name(move(first_name)), taken_holidays(0)
|
||||
{
|
||||
day_of_birth.tm_mday = day;
|
||||
day_of_birth.tm_mon = month - 1;
|
||||
day_of_birth.tm_year = year - 1900;
|
||||
|
||||
day_of_birth = Date(day, month, year);
|
||||
holidays = 30;
|
||||
}
|
||||
|
||||
string name;
|
||||
string first_name;
|
||||
tm day_of_birth;
|
||||
Date day_of_birth;
|
||||
int holidays;
|
||||
int taken_holidays;
|
||||
|
||||
|
||||
};
|
||||
|
||||
static list<Employee> employees;
|
||||
|
||||
void CreateEmployee();
|
||||
void create_employee();
|
||||
|
||||
int main()
|
||||
{
|
||||
bool end_program = false;
|
||||
auto end_program = false;
|
||||
while (!end_program)
|
||||
{
|
||||
int input = 1;
|
||||
system("cls");
|
||||
cout << "Urlaubsverwaltung" << endl << endl;
|
||||
cout << "Bitte wählen Sie eine Option:" << endl;
|
||||
@ -46,12 +60,14 @@ int main()
|
||||
cout << "4: Mitarbeiter suchen" << endl;
|
||||
cout << "5: Alle Mitarbeiter auflisten" << endl;
|
||||
cout << "0: Programm beenden" << endl;
|
||||
cout << "ihre Eingabe:";
|
||||
auto input = 0;
|
||||
cin >> input;
|
||||
|
||||
switch (input)
|
||||
{
|
||||
case 1:
|
||||
CreateEmployee();
|
||||
create_employee();
|
||||
break;
|
||||
case 2:
|
||||
break;
|
||||
@ -66,33 +82,35 @@ int main()
|
||||
break;
|
||||
default:
|
||||
cout << "Unerlaubte Eingabe" << endl;
|
||||
|
||||
system("pause");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CreateEmployee()
|
||||
void create_employee()
|
||||
{
|
||||
string name;
|
||||
string first_name;
|
||||
cout << "Bitte einen Namen eingeben: ";
|
||||
cin >> name;
|
||||
cout << endl;
|
||||
cout << "Bitte einen Vornamen eingeben: ";
|
||||
cin >> first_name;
|
||||
cout << endl;
|
||||
cout << "Bitte das Geburtsdatum eingeben: " << endl;
|
||||
int day;
|
||||
cout << "Tag: ";
|
||||
cin >> day;
|
||||
int month;
|
||||
cout << "Monat: ";
|
||||
cin >> month;
|
||||
int year;
|
||||
cout << "Jahr: ";
|
||||
cin >> year;
|
||||
|
||||
Employee em = Employee(name, first_name, day, month, year);
|
||||
|
||||
//employees.push_back()
|
||||
while (true)
|
||||
{
|
||||
string name;
|
||||
string first_name;
|
||||
cout << "Bitte einen Namen eingeben: ";
|
||||
cin >> name;
|
||||
cout << "Bitte einen Vornamen eingeben: ";
|
||||
cin >> first_name;
|
||||
cout << "Bitte das Geburtsdatum eingeben: " << endl;
|
||||
short day;
|
||||
cout << "Tag: ";
|
||||
cin >> day;
|
||||
short month;
|
||||
cout << "Monat: ";
|
||||
cin >> month;
|
||||
unsigned int year;
|
||||
cout << "Jahr: ";
|
||||
cin >> year;
|
||||
employees.emplace_back(name, first_name, day, month, year);
|
||||
cout << "Einen weiteren Benutzer eingeben? [J/N]" << endl;
|
||||
string input;
|
||||
cin >> input;
|
||||
if (input._Equal("N")|| input._Equal("n")) break;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user