-
Notifications
You must be signed in to change notification settings - Fork 194
Expand file tree
/
Copy pathmain.cpp
More file actions
40 lines (34 loc) · 684 Bytes
/
Copy pathmain.cpp
File metadata and controls
40 lines (34 loc) · 684 Bytes
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
#include "fsmlist.hpp"
#include <iostream>
int main()
{
fsm_list::start();
Call call;
FloorSensor sensor;
while(1)
{
char c;
std::cout << "c=Call, f=FloorSensor, a=Alarm, q=Quit ? ";
std::cin >> c;
switch(c) {
case 'c':
std::cout << "Floor ? ";
std::cin >> call.floor;
send_event(call);
break;
case 'f':
std::cout << "Floor ? ";
std::cin >> sensor.floor;
send_event(sensor);
break;
case 'a':
send_event(Alarm());
break;
case 'q':
std::cout << "Thanks for playing!" << std::endl;
return 0;
default:
std::cout << "Invalid input" << std::endl;
};
}
}