summaryrefslogtreecommitdiffstats
path: root/Bachelor/Prog2/Prakt2/SmartHouse/main.cpp
blob: eadd146aa9bd61650350e3a58816da2189dac45b (plain)
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
#include <iostream>
#include "Coffeemachine.h"
#include "Heating.h"
#include "Radio.h"
#include "GeneralDevice.h"

using std::cin;
using std::cout;
using std::endl;
using std::string;

int main()
{
	GeneralDevice *actualDevice;
	GeneralDevice *array[5];
	
	char input;
	
	Heating htog("Heizung OG");
	Heating hteg("Heizung EG");
	Coffeemachine cm("Tchibo KM 3");
	Radio radw("Radio Wohnzimmer");
	Radio radk("Radio K�che");
	
	array[0]=&cm;
	array[1]=&radw;	
	array[2]=&radk;
	array[3]=&htog;
	array[4]=&hteg;
	
	actualDevice=array[0];
	
	cout << "SmartHouse" << endl;
	
	do
	{
		cout << "+ : laut/warm/mehr" << endl;
		cout << "- : leise/kalt/weniger" << endl;
		cout << "1 : Tchibo KM 3"<<endl;
		cout << "2 : Radio Wohnzimmer"<<endl;
		cout << "3 : Radio K�che"<<endl;
		cout << "4 : Heizung OG"<<endl;
		cout << "5 : Heizung EG"<<endl;
		cout << "? : �bersicht"<<endl;
		cout << "0 : aus"<<endl;
		//input=cin.get();
		cin >> input;
		switch (input) {
			case '1':actualDevice=array[0]; break;
			case '2':actualDevice=array[1]; break;
			case '3':actualDevice=array[2]; break;
			case '4':actualDevice=array[3]; break;
			case '5': actualDevice=array[4]; break;
			case '+': (*actualDevice)++; break;
			case '-': (*actualDevice)--; break;
			case '?': cout << *actualDevice; break;
		}					
	}while (input!='0');
	
	return 0;
}