diff options
| author | Sven Eisenhauer <sven@sven-eisenhauer.net> | 2023-11-10 15:11:48 +0100 |
|---|---|---|
| committer | Sven Eisenhauer <sven@sven-eisenhauer.net> | 2023-11-10 15:11:48 +0100 |
| commit | 33613a85afc4b1481367fbe92a17ee59c240250b (patch) | |
| tree | 670b842326116b376b505ec2263878912fca97e2 /Bachelor/Prog2/Prakt2/SmartHouse | |
| download | Studium-33613a85afc4b1481367fbe92a17ee59c240250b.tar.gz Studium-33613a85afc4b1481367fbe92a17ee59c240250b.tar.bz2 | |
Diffstat (limited to 'Bachelor/Prog2/Prakt2/SmartHouse')
23 files changed, 551 insertions, 0 deletions
diff --git a/Bachelor/Prog2/Prakt2/SmartHouse/.cdtbuild b/Bachelor/Prog2/Prakt2/SmartHouse/.cdtbuild new file mode 100644 index 0000000..6318112 --- /dev/null +++ b/Bachelor/Prog2/Prakt2/SmartHouse/.cdtbuild @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<?fileVersion 2.1.0?>
+
+<ManagedProjectBuildInfo>
+<project id="SmartHouse.cdt.managedbuild.target.gnu.exe.1040245498" name="Executable (Gnu)" projectType="cdt.managedbuild.target.gnu.exe">
+<configuration id="cdt.managedbuild.config.gnu.exe.debug.240199794" name="Debug" parent="cdt.managedbuild.config.gnu.exe.debug" artifactName="SmartHouse" errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" cleanCommand="rm -rf">
+<toolChain superClass="cdt.managedbuild.toolchain.gnu.exe.debug" id="cdt.managedbuild.toolchain.gnu.exe.debug.275731498" name="GCC Tool Chain">
+<tool superClass="cdt.managedbuild.tool.gnu.c.compiler.exe.debug" id="cdt.managedbuild.tool.gnu.c.compiler.exe.debug.1456875189" name="GCC C Compiler"/>
+<tool superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug" id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.359016985" name="GCC C++ Compiler"/>
+<tool superClass="cdt.managedbuild.tool.gnu.c.linker.exe.debug" id="cdt.managedbuild.tool.gnu.c.linker.exe.debug.1893305652" name="GCC C Linker"/>
+<tool superClass="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug" id="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug.725660303" name="GCC C++ Linker"/>
+<tool superClass="cdt.managedbuild.tool.gnu.assembler.exe.debug" id="cdt.managedbuild.tool.gnu.assembler.exe.debug.1626310915" name="GCC Assembler"/>
+</toolChain>
+</configuration>
+<configuration id="cdt.managedbuild.config.gnu.exe.release.1801815739" name="Release" parent="cdt.managedbuild.config.gnu.exe.release" artifactName="SmartHouse" errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" cleanCommand="rm -rf">
+<toolChain superClass="cdt.managedbuild.toolchain.gnu.exe.release" id="cdt.managedbuild.toolchain.gnu.exe.release.402764758" name="GCC Tool Chain">
+<tool superClass="cdt.managedbuild.tool.gnu.c.compiler.exe.release" id="cdt.managedbuild.tool.gnu.c.compiler.exe.release.1034718652" name="GCC C Compiler"/>
+<tool superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.release" id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.release.484912643" name="GCC C++ Compiler"/>
+<tool superClass="cdt.managedbuild.tool.gnu.c.linker.exe.release" id="cdt.managedbuild.tool.gnu.c.linker.exe.release.1269000869" name="GCC C Linker"/>
+<tool superClass="cdt.managedbuild.tool.gnu.cpp.linker.exe.release" id="cdt.managedbuild.tool.gnu.cpp.linker.exe.release.456112124" name="GCC C++ Linker"/>
+<tool superClass="cdt.managedbuild.tool.gnu.assembler.exe.release" id="cdt.managedbuild.tool.gnu.assembler.exe.release.1332270129" name="GCC Assembler"/>
+</toolChain>
+</configuration>
+</project>
+</ManagedProjectBuildInfo>
diff --git a/Bachelor/Prog2/Prakt2/SmartHouse/.cdtproject b/Bachelor/Prog2/Prakt2/SmartHouse/.cdtproject new file mode 100644 index 0000000..aecd7f1 --- /dev/null +++ b/Bachelor/Prog2/Prakt2/SmartHouse/.cdtproject @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse-cdt version="2.0"?>
+
+<cdtproject id="org.eclipse.cdt.managedbuilder.core.managedMake">
+<extension point="org.eclipse.cdt.core.ScannerInfoProvider" id="org.eclipse.cdt.managedbuilder.core.ManagedBuildManager"/>
+<extension point="org.eclipse.cdt.core.BinaryParser" id="org.eclipse.cdt.core.ELF"/>
+<data>
+<item id="cdt_indexer">
+<indexEnabled indexValue="true"/>
+<indexerProblemsEnabled indexProblemsValue="7"/>
+</item>
+<item id="org.eclipse.cdt.core.pathentry">
+<pathentry kind="src" path=""/>
+<pathentry kind="out" path=""/>
+<pathentry kind="con" path="org.eclipse.cdt.managedbuilder.MANAGED_CONTAINER"/>
+</item>
+</data>
+</cdtproject>
diff --git a/Bachelor/Prog2/Prakt2/SmartHouse/.project b/Bachelor/Prog2/Prakt2/SmartHouse/.project new file mode 100644 index 0000000..58e9156 --- /dev/null +++ b/Bachelor/Prog2/Prakt2/SmartHouse/.project @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>SmartHouse</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.core.ccnature</nature>
+ </natures>
+</projectDescription>
diff --git a/Bachelor/Prog2/Prakt2/SmartHouse/Coffeemachine.cpp b/Bachelor/Prog2/Prakt2/SmartHouse/Coffeemachine.cpp new file mode 100644 index 0000000..68c6e5e --- /dev/null +++ b/Bachelor/Prog2/Prakt2/SmartHouse/Coffeemachine.cpp @@ -0,0 +1,42 @@ +#include "Coffeemachine.h"
+#include <iostream>
+
+using std::cout;
+using std::endl;
+using std::string;
+//using std::istream;
+using std::ostream;
+
+Coffeemachine::Coffeemachine()
+{
+ numberOfCups=0;
+ cout << "Konstruktor Coffeemachine called" << endl;
+}
+
+Coffeemachine::Coffeemachine(char * devName)
+ :GeneralDevice(devName)
+{
+ numberOfCups=0;
+ cout << "Überladener Konstruktor Coffeemachine called" << endl;
+}
+
+Coffeemachine::~Coffeemachine()
+{
+ cout << "Destruktor Coffeemachine called" << endl;
+}
+
+void Coffeemachine::operator++(int)
+{
+ numberOfCups++;
+}
+
+void Coffeemachine::operator--(int)
+{
+ numberOfCups<=0?numberOfCups=0:numberOfCups--;
+}
+
+void Coffeemachine::print()
+{
+ cout << "Name: " << getDeviceName()
+ << " Cups: " << numberOfCups << endl;
+}
diff --git a/Bachelor/Prog2/Prakt2/SmartHouse/Coffeemachine.h b/Bachelor/Prog2/Prakt2/SmartHouse/Coffeemachine.h new file mode 100644 index 0000000..d5d2ac5 --- /dev/null +++ b/Bachelor/Prog2/Prakt2/SmartHouse/Coffeemachine.h @@ -0,0 +1,26 @@ +#ifndef _COFFEEMACHINE_H_
+#define _COFFEEMACHINE_H_
+
+#include "GeneralDevice.h"
+#include <iostream>
+
+using std::istream;
+using std::ostream;
+
+class Coffeemachine : public GeneralDevice
+{
+ //friend ostream &operator<<( ostream&, const Coffeemachine & );
+
+public:
+ Coffeemachine();
+ Coffeemachine(char *);
+ virtual ~Coffeemachine();
+ virtual void operator++(int);
+ virtual void operator--(int);
+ virtual void print();
+
+private:
+ int numberOfCups;
+};
+
+#endif //_COFFEEMACHINE_H_
diff --git a/Bachelor/Prog2/Prakt2/SmartHouse/Debug/Coffeemachine.d b/Bachelor/Prog2/Prakt2/SmartHouse/Debug/Coffeemachine.d new file mode 100644 index 0000000..6148646 --- /dev/null +++ b/Bachelor/Prog2/Prakt2/SmartHouse/Debug/Coffeemachine.d @@ -0,0 +1,11 @@ +################################################################################
+# Automatically-generated file. Do not edit!
+################################################################################
+
+Coffeemachine.d ./Coffeemachine.o: ../Coffeemachine.cpp ../Coffeemachine.h \
+ ../GeneralDevice.h
+
+../Coffeemachine.h:
+
+../GeneralDevice.h:
+
diff --git a/Bachelor/Prog2/Prakt2/SmartHouse/Debug/GeneralDevice.d b/Bachelor/Prog2/Prakt2/SmartHouse/Debug/GeneralDevice.d new file mode 100644 index 0000000..9c526ae --- /dev/null +++ b/Bachelor/Prog2/Prakt2/SmartHouse/Debug/GeneralDevice.d @@ -0,0 +1,8 @@ +################################################################################
+# Automatically-generated file. Do not edit!
+################################################################################
+
+GeneralDevice.d ./GeneralDevice.o: ../GeneralDevice.cpp ../GeneralDevice.h
+
+../GeneralDevice.h:
+
diff --git a/Bachelor/Prog2/Prakt2/SmartHouse/Debug/Heating.d b/Bachelor/Prog2/Prakt2/SmartHouse/Debug/Heating.d new file mode 100644 index 0000000..1b8c962 --- /dev/null +++ b/Bachelor/Prog2/Prakt2/SmartHouse/Debug/Heating.d @@ -0,0 +1,10 @@ +################################################################################
+# Automatically-generated file. Do not edit!
+################################################################################
+
+Heating.d ./Heating.o: ../Heating.cpp ../Heating.h ../GeneralDevice.h
+
+../Heating.h:
+
+../GeneralDevice.h:
+
diff --git a/Bachelor/Prog2/Prakt2/SmartHouse/Debug/Radio.d b/Bachelor/Prog2/Prakt2/SmartHouse/Debug/Radio.d new file mode 100644 index 0000000..a543cf7 --- /dev/null +++ b/Bachelor/Prog2/Prakt2/SmartHouse/Debug/Radio.d @@ -0,0 +1,10 @@ +################################################################################
+# Automatically-generated file. Do not edit!
+################################################################################
+
+Radio.d ./Radio.o: ../Radio.cpp ../Radio.h ../GeneralDevice.h
+
+../Radio.h:
+
+../GeneralDevice.h:
+
diff --git a/Bachelor/Prog2/Prakt2/SmartHouse/Debug/SmartHouse b/Bachelor/Prog2/Prakt2/SmartHouse/Debug/SmartHouse Binary files differnew file mode 100644 index 0000000..c4b3586 --- /dev/null +++ b/Bachelor/Prog2/Prakt2/SmartHouse/Debug/SmartHouse diff --git a/Bachelor/Prog2/Prakt2/SmartHouse/Debug/main.d b/Bachelor/Prog2/Prakt2/SmartHouse/Debug/main.d new file mode 100644 index 0000000..891f3e9 --- /dev/null +++ b/Bachelor/Prog2/Prakt2/SmartHouse/Debug/main.d @@ -0,0 +1,15 @@ +################################################################################
+# Automatically-generated file. Do not edit!
+################################################################################
+
+main.d ./main.o: ../main.cpp ../Coffeemachine.h ../GeneralDevice.h ../Heating.h \
+ ../Radio.h
+
+../Coffeemachine.h:
+
+../GeneralDevice.h:
+
+../Heating.h:
+
+../Radio.h:
+
diff --git a/Bachelor/Prog2/Prakt2/SmartHouse/Debug/makefile b/Bachelor/Prog2/Prakt2/SmartHouse/Debug/makefile new file mode 100644 index 0000000..7e0fccb --- /dev/null +++ b/Bachelor/Prog2/Prakt2/SmartHouse/Debug/makefile @@ -0,0 +1,30 @@ +################################################################################
+# Automatically-generated file. Do not edit!
+################################################################################
+
+ROOT := ..
+
+-include $(ROOT)/makefile.init
+
+RM := rm -rf
+
+# All of the sources participating in the build are defined here
+-include sources.mk
+-include $(SUBDIRS:%=%/subdir.mk)
+-include objects.mk
+-include $(DEPS)
+-include $(ROOT)/makefile.defs
+
+all: SmartHouse
+
+SmartHouse: $(OBJS)
+ @echo 'Building target: $@'
+ g++ -o $@ $(OBJS) $(USER_OBJS) $(LIBS)
+ @echo 'Finished building: $@'
+
+clean:
+ -$(RM) $(OBJS) $(DEPS) SmartHouse
+
+.PHONY: all clean dependents
+
+-include $(ROOT)/makefile.targets
diff --git a/Bachelor/Prog2/Prakt2/SmartHouse/Debug/objects.mk b/Bachelor/Prog2/Prakt2/SmartHouse/Debug/objects.mk new file mode 100644 index 0000000..59a3b5b --- /dev/null +++ b/Bachelor/Prog2/Prakt2/SmartHouse/Debug/objects.mk @@ -0,0 +1,13 @@ +################################################################################
+# Automatically-generated file. Do not edit!
+################################################################################
+
+LIBS :=
+USER_OBJS :=
+
+
+OBJS := \
+ $(C_SRCS:$(ROOT)/%.c=%.o) $(C_UPPER_SRCS:$(ROOT)/%.C=%.o) $(CC_SRCS:$(ROOT)/%.cc=%.o) $(CXX_SRCS:$(ROOT)/%.cxx=%.o) $(CPP_SRCS:$(ROOT)/%.cpp=%.o) $(S_SRCS:$(ROOT)/%.s=%.o) $(S_UPPER_SRCS:$(ROOT)/%.S=%.o)
+
+DEPS := \
+ $(C_SRCS:$(ROOT)/%.c=%.d) $(C_UPPER_SRCS:$(ROOT)/%.C=%.d) $(CC_SRCS:$(ROOT)/%.cc=%.d) $(CXX_SRCS:$(ROOT)/%.cxx=%.d) $(CPP_SRCS:$(ROOT)/%.cpp=%.d) $(S_SRCS:$(ROOT)/%.s=%.d) $(S_UPPER_SRCS:$(ROOT)/%.S=%.d)
\ No newline at end of file diff --git a/Bachelor/Prog2/Prakt2/SmartHouse/Debug/sources.mk b/Bachelor/Prog2/Prakt2/SmartHouse/Debug/sources.mk new file mode 100644 index 0000000..357bfc1 --- /dev/null +++ b/Bachelor/Prog2/Prakt2/SmartHouse/Debug/sources.mk @@ -0,0 +1,16 @@ +################################################################################
+# Automatically-generated file. Do not edit!
+################################################################################
+
+C_SRCS :=
+C_UPPER_SRCS :=
+CC_SRCS :=
+CXX_SRCS :=
+CPP_SRCS :=
+S_SRCS :=
+S_UPPER_SRCS :=
+
+# Every subdirectory with source files must be described here
+SUBDIRS := \
+. \
+
diff --git a/Bachelor/Prog2/Prakt2/SmartHouse/Debug/subdir.mk b/Bachelor/Prog2/Prakt2/SmartHouse/Debug/subdir.mk new file mode 100644 index 0000000..b0df7bd --- /dev/null +++ b/Bachelor/Prog2/Prakt2/SmartHouse/Debug/subdir.mk @@ -0,0 +1,48 @@ +################################################################################
+# Automatically-generated file. Do not edit!
+################################################################################
+
+S_UPPER_SRCS += \
+${addprefix $(ROOT)/, \
+}
+
+CPP_SRCS += \
+${addprefix $(ROOT)/, \
+Coffeemachine.cpp \
+GeneralDevice.cpp \
+Heating.cpp \
+Radio.cpp \
+main.cpp \
+}
+
+CC_SRCS += \
+${addprefix $(ROOT)/, \
+}
+
+C_SRCS += \
+${addprefix $(ROOT)/, \
+}
+
+C_UPPER_SRCS += \
+${addprefix $(ROOT)/, \
+}
+
+CXX_SRCS += \
+${addprefix $(ROOT)/, \
+}
+
+S_SRCS += \
+${addprefix $(ROOT)/, \
+}
+
+# Each subdirectory must supply rules for building sources it contributes
+%.o: $(ROOT)/%.cpp
+ @echo 'Building file: $<'
+ @echo g++ -O0 -g3 -Wall -c -fmessage-length=0 -o$@ $<
+ @g++ -O0 -g3 -Wall -c -fmessage-length=0 -o$@ $< && \
+ echo -n $(@:%.o=%.d) $(dir $@) > $(@:%.o=%.d) && \
+ g++ -MM -MG -P -w -O0 -g3 -Wall -c -fmessage-length=0 $< >> $(@:%.o=%.d)
+ @echo 'Finished building: $<'
+ @echo ' '
+
+
diff --git a/Bachelor/Prog2/Prakt2/SmartHouse/GeneralDevice.cpp b/Bachelor/Prog2/Prakt2/SmartHouse/GeneralDevice.cpp new file mode 100644 index 0000000..738051e --- /dev/null +++ b/Bachelor/Prog2/Prakt2/SmartHouse/GeneralDevice.cpp @@ -0,0 +1,42 @@ +#include "GeneralDevice.h"
+#include <string>
+#include <iostream>
+
+using std::cout;
+using std::endl;
+using std::istream;
+using std::ostream;
+using std::string;
+
+ostream &operator<<( ostream& outstream, GeneralDevice &GenDev)
+{
+ GenDev.print();
+ return outstream;
+}
+
+GeneralDevice::GeneralDevice()
+{
+ cout << "Konstruktor GeneralDevice called" << endl;
+}
+
+GeneralDevice::GeneralDevice(char* devName)
+ :deviceName(devName)
+{
+ cout << "Überladener Konstruktor GeneralDevice called" << endl;
+}
+
+GeneralDevice::~GeneralDevice()
+{
+ cout << "Destruktor GeneralDevice called" << endl;
+}
+
+string GeneralDevice::getDeviceName()
+{
+ //cout << deviceName;
+ return deviceName;
+}
+
+void GeneralDevice::setDeviceName(string devName)
+{
+ deviceName=devName;
+}
diff --git a/Bachelor/Prog2/Prakt2/SmartHouse/GeneralDevice.h b/Bachelor/Prog2/Prakt2/SmartHouse/GeneralDevice.h new file mode 100644 index 0000000..44512f2 --- /dev/null +++ b/Bachelor/Prog2/Prakt2/SmartHouse/GeneralDevice.h @@ -0,0 +1,28 @@ +#ifndef _GENERALDEVICE_H_
+#define _GENERALDEVICE_H_
+
+#include <string>
+#include <iostream>
+
+//using std::istream;
+using std::ostream;
+using std::string;
+
+class GeneralDevice
+{
+friend ostream &operator<<( ostream&, GeneralDevice &);
+
+public:
+ GeneralDevice();
+ GeneralDevice(char *);
+ virtual ~GeneralDevice();
+ virtual void operator++(int) =0;
+ virtual void operator--(int) =0;
+ string getDeviceName();
+ void setDeviceName(string);
+ virtual void print()=0;
+private:
+ string deviceName;
+};
+
+#endif //_GENERALDEVICE_H_
diff --git a/Bachelor/Prog2/Prakt2/SmartHouse/Heating.cpp b/Bachelor/Prog2/Prakt2/SmartHouse/Heating.cpp new file mode 100644 index 0000000..1669848 --- /dev/null +++ b/Bachelor/Prog2/Prakt2/SmartHouse/Heating.cpp @@ -0,0 +1,40 @@ +#include "Heating.h"
+#include <iostream>
+
+using std::cout;
+using std::endl;
+using std::string;
+
+Heating::Heating()
+{
+ temperature=0;
+ cout << "Konstruktor Heating called" << endl;
+}
+
+Heating::Heating(char * devName)
+ : GeneralDevice(devName)
+{
+ temperature=0;
+ cout << "Überladener Konstruktor Heating called" << endl;
+}
+
+Heating::~Heating()
+{
+ cout << "Destruktor Heating called" << endl;
+}
+
+void Heating::operator++(int)
+{
+ temperature++;
+}
+
+void Heating::operator--(int)
+{
+ temperature<=0?temperature=0:temperature--;
+}
+
+void Heating::print()
+{
+ cout << "Name: " << getDeviceName()
+ << " Temperatur: " << temperature << endl;
+}
diff --git a/Bachelor/Prog2/Prakt2/SmartHouse/Heating.h b/Bachelor/Prog2/Prakt2/SmartHouse/Heating.h new file mode 100644 index 0000000..d1e5d3c --- /dev/null +++ b/Bachelor/Prog2/Prakt2/SmartHouse/Heating.h @@ -0,0 +1,26 @@ +#ifndef _HEATING_H_
+#define _HEATING_H_
+
+#include "GeneralDevice.h"
+#include <iostream>
+
+//using std::istream;
+using std::ostream;
+
+class Heating : public GeneralDevice
+{
+ //friend ostream &operator<<( ostream&, const Heating& );
+
+public:
+ Heating();
+ Heating(char *);
+ virtual ~Heating();
+ virtual void operator++(int);
+ virtual void operator--(int);
+ virtual void print();
+
+private:
+ float temperature;
+};
+
+#endif //_HEATING_H_
diff --git a/Bachelor/Prog2/Prakt2/SmartHouse/Radio.cpp b/Bachelor/Prog2/Prakt2/SmartHouse/Radio.cpp new file mode 100644 index 0000000..6cbc24b --- /dev/null +++ b/Bachelor/Prog2/Prakt2/SmartHouse/Radio.cpp @@ -0,0 +1,38 @@ +#include "Radio.h"
+#include <iostream>
+
+using std::cout;
+using std::endl;
+
+Radio::Radio()
+{
+ volume=0;
+ cout << "Konstruktor Radio called" << endl;
+}
+
+Radio::Radio(char * devName)
+ :GeneralDevice(devName)
+{
+ volume=0;
+ cout << "Überladener Konstruktor Radio called" << endl;
+}
+
+Radio::~Radio()
+{
+ cout << "Destruktor Radio called" << endl;
+}
+
+void Radio::operator++(int)
+{
+ volume++;
+}
+
+void Radio::operator--(int)
+{
+ volume<=0?volume=0:volume--;
+}
+
+void Radio::print()
+{
+ cout << "Name: "<< getDeviceName() << " Volume: " << volume << endl;
+}
diff --git a/Bachelor/Prog2/Prakt2/SmartHouse/Radio.h b/Bachelor/Prog2/Prakt2/SmartHouse/Radio.h new file mode 100644 index 0000000..4f839f7 --- /dev/null +++ b/Bachelor/Prog2/Prakt2/SmartHouse/Radio.h @@ -0,0 +1,25 @@ +#ifndef _RADIO_H_
+#define _RADIO_H_
+
+#include "GeneralDevice.h"
+#include <iostream>
+
+//using std::istream;
+using std::ostream;
+
+class Radio : public GeneralDevice
+{
+ //friend ostream &operator<<( ostream&, const Radio& );
+
+public:
+ Radio();
+ Radio(char *);
+ virtual ~Radio();
+ virtual void operator++(int);
+ virtual void operator--(int);
+ virtual void print();
+private:
+ double volume;
+};
+
+#endif //_RADIO_H_
diff --git a/Bachelor/Prog2/Prakt2/SmartHouse/main.cpp b/Bachelor/Prog2/Prakt2/SmartHouse/main.cpp new file mode 100644 index 0000000..eadd146 --- /dev/null +++ b/Bachelor/Prog2/Prakt2/SmartHouse/main.cpp @@ -0,0 +1,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;
+}
diff --git a/Bachelor/Prog2/Prakt2/SmartHouse/prg2p2_1.zip b/Bachelor/Prog2/Prakt2/SmartHouse/prg2p2_1.zip Binary files differnew file mode 100644 index 0000000..61c418b --- /dev/null +++ b/Bachelor/Prog2/Prakt2/SmartHouse/prg2p2_1.zip |
