-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes_p2.h
More file actions
97 lines (56 loc) · 1.39 KB
/
types_p2.h
File metadata and controls
97 lines (56 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
WeChat: cstutorcs
QQ: 749389476
Email: tutorcs@163.com
#ifndef __TYPES_P2_H
#define __TYPES_P2_H
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <sys/time.h>
#include <string>
#include <vector>
#include <unistd.h>
#define EMPTY 0
#define WOMENPRESENT 1
#define MENPRESENT 2
class Person
{
int gender; // 0: male 1: female
std::string str_gender;
struct timeval t_create;
struct timeval t_start;
struct timeval t_end;
long time_to_stay_ms;
unsigned long order;
unsigned long use_order;
public:
Person();
void set_gender(int data);
int get_gender(void);
void set_order(unsigned long data);
unsigned long get_order(void);
void set_use_order(unsigned long data);
unsigned long get_use_order(void);
void set_time(long data);
int ready_to_leave(void);
void start(void);
void complete(void);
};
// Class for the restroom
// You may need to add more class member variables and functions
class Restroom {
int status;
// You need to define the data structure to
// save the information of people using the restroom
// You can probebly use Standard Template Library (STL) vector
public:
Restroom(){
status = EMPTY;
}
// You need to use this function to print the Restroom's status
void print_status(void);
// Call by reference
// This is just an example. You can implement any function you need
void add_person(Person& p);
};
#endif