From 33613a85afc4b1481367fbe92a17ee59c240250b Mon Sep 17 00:00:00 2001 From: Sven Eisenhauer Date: Fri, 10 Nov 2023 15:11:48 +0100 Subject: add new repo --- Bachelor/Prog2/Prakt2/SmartHouse/.cdtbuild | 25 +++++++++ Bachelor/Prog2/Prakt2/SmartHouse/.cdtproject | 18 ++++++ Bachelor/Prog2/Prakt2/SmartHouse/.project | 19 +++++++ Bachelor/Prog2/Prakt2/SmartHouse/Coffeemachine.cpp | 42 ++++++++++++++ Bachelor/Prog2/Prakt2/SmartHouse/Coffeemachine.h | 26 +++++++++ .../Prog2/Prakt2/SmartHouse/Debug/Coffeemachine.d | 11 ++++ .../Prog2/Prakt2/SmartHouse/Debug/GeneralDevice.d | 8 +++ Bachelor/Prog2/Prakt2/SmartHouse/Debug/Heating.d | 10 ++++ Bachelor/Prog2/Prakt2/SmartHouse/Debug/Radio.d | 10 ++++ Bachelor/Prog2/Prakt2/SmartHouse/Debug/SmartHouse | Bin 0 -> 847098 bytes Bachelor/Prog2/Prakt2/SmartHouse/Debug/main.d | 15 +++++ Bachelor/Prog2/Prakt2/SmartHouse/Debug/makefile | 30 ++++++++++ Bachelor/Prog2/Prakt2/SmartHouse/Debug/objects.mk | 13 +++++ Bachelor/Prog2/Prakt2/SmartHouse/Debug/sources.mk | 16 ++++++ Bachelor/Prog2/Prakt2/SmartHouse/Debug/subdir.mk | 48 ++++++++++++++++ Bachelor/Prog2/Prakt2/SmartHouse/GeneralDevice.cpp | 42 ++++++++++++++ Bachelor/Prog2/Prakt2/SmartHouse/GeneralDevice.h | 28 ++++++++++ Bachelor/Prog2/Prakt2/SmartHouse/Heating.cpp | 40 ++++++++++++++ Bachelor/Prog2/Prakt2/SmartHouse/Heating.h | 26 +++++++++ Bachelor/Prog2/Prakt2/SmartHouse/Radio.cpp | 38 +++++++++++++ Bachelor/Prog2/Prakt2/SmartHouse/Radio.h | 25 +++++++++ Bachelor/Prog2/Prakt2/SmartHouse/main.cpp | 61 +++++++++++++++++++++ Bachelor/Prog2/Prakt2/SmartHouse/prg2p2_1.zip | Bin 0 -> 3735 bytes Bachelor/Prog2/Prakt2/geomObj/.cdtbuild | 25 +++++++++ Bachelor/Prog2/Prakt2/geomObj/.cdtproject | 18 ++++++ Bachelor/Prog2/Prakt2/geomObj/.project | 19 +++++++ Bachelor/Prog2/Prakt2/geomObj/Circle.cpp | 27 +++++++++ Bachelor/Prog2/Prakt2/geomObj/Circle.h | 18 ++++++ Bachelor/Prog2/Prakt2/geomObj/Debug/Circle.d | 10 ++++ Bachelor/Prog2/Prakt2/geomObj/Debug/Rectangle.d | 10 ++++ Bachelor/Prog2/Prakt2/geomObj/Debug/Shape.d | 8 +++ Bachelor/Prog2/Prakt2/geomObj/Debug/Square.d | 12 ++++ Bachelor/Prog2/Prakt2/geomObj/Debug/geomObj | Bin 0 -> 197267 bytes Bachelor/Prog2/Prakt2/geomObj/Debug/main.d | 14 +++++ Bachelor/Prog2/Prakt2/geomObj/Debug/makefile | 30 ++++++++++ Bachelor/Prog2/Prakt2/geomObj/Debug/objects.mk | 13 +++++ Bachelor/Prog2/Prakt2/geomObj/Debug/sources.mk | 16 ++++++ Bachelor/Prog2/Prakt2/geomObj/Debug/subdir.mk | 48 ++++++++++++++++ Bachelor/Prog2/Prakt2/geomObj/Rectangle.cpp | 25 +++++++++ Bachelor/Prog2/Prakt2/geomObj/Rectangle.h | 19 +++++++ Bachelor/Prog2/Prakt2/geomObj/Shape.cpp | 14 +++++ Bachelor/Prog2/Prakt2/geomObj/Shape.h | 14 +++++ Bachelor/Prog2/Prakt2/geomObj/Square.cpp | 25 +++++++++ Bachelor/Prog2/Prakt2/geomObj/Square.h | 18 ++++++ Bachelor/Prog2/Prakt2/geomObj/geomObj.zip | Bin 0 -> 2665 bytes Bachelor/Prog2/Prakt2/geomObj/main.cpp | 39 +++++++++++++ 46 files changed, 973 insertions(+) create mode 100644 Bachelor/Prog2/Prakt2/SmartHouse/.cdtbuild create mode 100644 Bachelor/Prog2/Prakt2/SmartHouse/.cdtproject create mode 100644 Bachelor/Prog2/Prakt2/SmartHouse/.project create mode 100644 Bachelor/Prog2/Prakt2/SmartHouse/Coffeemachine.cpp create mode 100644 Bachelor/Prog2/Prakt2/SmartHouse/Coffeemachine.h create mode 100644 Bachelor/Prog2/Prakt2/SmartHouse/Debug/Coffeemachine.d create mode 100644 Bachelor/Prog2/Prakt2/SmartHouse/Debug/GeneralDevice.d create mode 100644 Bachelor/Prog2/Prakt2/SmartHouse/Debug/Heating.d create mode 100644 Bachelor/Prog2/Prakt2/SmartHouse/Debug/Radio.d create mode 100644 Bachelor/Prog2/Prakt2/SmartHouse/Debug/SmartHouse create mode 100644 Bachelor/Prog2/Prakt2/SmartHouse/Debug/main.d create mode 100644 Bachelor/Prog2/Prakt2/SmartHouse/Debug/makefile create mode 100644 Bachelor/Prog2/Prakt2/SmartHouse/Debug/objects.mk create mode 100644 Bachelor/Prog2/Prakt2/SmartHouse/Debug/sources.mk create mode 100644 Bachelor/Prog2/Prakt2/SmartHouse/Debug/subdir.mk create mode 100644 Bachelor/Prog2/Prakt2/SmartHouse/GeneralDevice.cpp create mode 100644 Bachelor/Prog2/Prakt2/SmartHouse/GeneralDevice.h create mode 100644 Bachelor/Prog2/Prakt2/SmartHouse/Heating.cpp create mode 100644 Bachelor/Prog2/Prakt2/SmartHouse/Heating.h create mode 100644 Bachelor/Prog2/Prakt2/SmartHouse/Radio.cpp create mode 100644 Bachelor/Prog2/Prakt2/SmartHouse/Radio.h create mode 100644 Bachelor/Prog2/Prakt2/SmartHouse/main.cpp create mode 100644 Bachelor/Prog2/Prakt2/SmartHouse/prg2p2_1.zip create mode 100644 Bachelor/Prog2/Prakt2/geomObj/.cdtbuild create mode 100644 Bachelor/Prog2/Prakt2/geomObj/.cdtproject create mode 100644 Bachelor/Prog2/Prakt2/geomObj/.project create mode 100644 Bachelor/Prog2/Prakt2/geomObj/Circle.cpp create mode 100644 Bachelor/Prog2/Prakt2/geomObj/Circle.h create mode 100644 Bachelor/Prog2/Prakt2/geomObj/Debug/Circle.d create mode 100644 Bachelor/Prog2/Prakt2/geomObj/Debug/Rectangle.d create mode 100644 Bachelor/Prog2/Prakt2/geomObj/Debug/Shape.d create mode 100644 Bachelor/Prog2/Prakt2/geomObj/Debug/Square.d create mode 100644 Bachelor/Prog2/Prakt2/geomObj/Debug/geomObj create mode 100644 Bachelor/Prog2/Prakt2/geomObj/Debug/main.d create mode 100644 Bachelor/Prog2/Prakt2/geomObj/Debug/makefile create mode 100644 Bachelor/Prog2/Prakt2/geomObj/Debug/objects.mk create mode 100644 Bachelor/Prog2/Prakt2/geomObj/Debug/sources.mk create mode 100644 Bachelor/Prog2/Prakt2/geomObj/Debug/subdir.mk create mode 100644 Bachelor/Prog2/Prakt2/geomObj/Rectangle.cpp create mode 100644 Bachelor/Prog2/Prakt2/geomObj/Rectangle.h create mode 100644 Bachelor/Prog2/Prakt2/geomObj/Shape.cpp create mode 100644 Bachelor/Prog2/Prakt2/geomObj/Shape.h create mode 100644 Bachelor/Prog2/Prakt2/geomObj/Square.cpp create mode 100644 Bachelor/Prog2/Prakt2/geomObj/Square.h create mode 100644 Bachelor/Prog2/Prakt2/geomObj/geomObj.zip create mode 100644 Bachelor/Prog2/Prakt2/geomObj/main.cpp (limited to 'Bachelor/Prog2/Prakt2') 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + + + + + 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 @@ + + + SmartHouse + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.core.ccnature + + 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 + +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 + +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 new file mode 100644 index 0000000..c4b3586 Binary files /dev/null and b/Bachelor/Prog2/Prakt2/SmartHouse/Debug/SmartHouse differ 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 +#include + +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 +#include + +//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 + +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 + +//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 + +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 + +//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 +#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"<> 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 new file mode 100644 index 0000000..61c418b Binary files /dev/null and b/Bachelor/Prog2/Prakt2/SmartHouse/prg2p2_1.zip differ diff --git a/Bachelor/Prog2/Prakt2/geomObj/.cdtbuild b/Bachelor/Prog2/Prakt2/geomObj/.cdtbuild new file mode 100644 index 0000000..e0c01e4 --- /dev/null +++ b/Bachelor/Prog2/Prakt2/geomObj/.cdtbuild @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Bachelor/Prog2/Prakt2/geomObj/.cdtproject b/Bachelor/Prog2/Prakt2/geomObj/.cdtproject new file mode 100644 index 0000000..82c36e0 --- /dev/null +++ b/Bachelor/Prog2/Prakt2/geomObj/.cdtproject @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/Bachelor/Prog2/Prakt2/geomObj/.project b/Bachelor/Prog2/Prakt2/geomObj/.project new file mode 100644 index 0000000..166cc9d --- /dev/null +++ b/Bachelor/Prog2/Prakt2/geomObj/.project @@ -0,0 +1,19 @@ + + + geomObj + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.core.ccnature + + diff --git a/Bachelor/Prog2/Prakt2/geomObj/Circle.cpp b/Bachelor/Prog2/Prakt2/geomObj/Circle.cpp new file mode 100644 index 0000000..14415bf --- /dev/null +++ b/Bachelor/Prog2/Prakt2/geomObj/Circle.cpp @@ -0,0 +1,27 @@ +#include "Circle.h" + +const double pi = 3.14159265358979; + +Circle::Circle() + :radius(.0) +{ +} + +Circle::Circle(double newR) + :radius(newR) +{ +} + +Circle::~Circle() +{ +} + +double Circle::getArea() +{ + return (radius * radius * pi); +} + +double Circle::getCircumference() +{ + return (2 * radius * pi); +} diff --git a/Bachelor/Prog2/Prakt2/geomObj/Circle.h b/Bachelor/Prog2/Prakt2/geomObj/Circle.h new file mode 100644 index 0000000..580b254 --- /dev/null +++ b/Bachelor/Prog2/Prakt2/geomObj/Circle.h @@ -0,0 +1,18 @@ +#ifndef _CIRCLE_H_ +#define _CIRCLE_H_ + +#include "Shape.h" + +class Circle : public Shape +{ +public: + Circle(); + Circle(double); + virtual ~Circle(); + virtual double getArea(); + virtual double getCircumference(); +private: + const double radius; +}; + +#endif //_CIRCLE_H_ diff --git a/Bachelor/Prog2/Prakt2/geomObj/Debug/Circle.d b/Bachelor/Prog2/Prakt2/geomObj/Debug/Circle.d new file mode 100644 index 0000000..61b13d0 --- /dev/null +++ b/Bachelor/Prog2/Prakt2/geomObj/Debug/Circle.d @@ -0,0 +1,10 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +Circle.d ./Circle.o: ../Circle.cpp ../Circle.h ../Shape.h + +../Circle.h: + +../Shape.h: + diff --git a/Bachelor/Prog2/Prakt2/geomObj/Debug/Rectangle.d b/Bachelor/Prog2/Prakt2/geomObj/Debug/Rectangle.d new file mode 100644 index 0000000..3cca9be --- /dev/null +++ b/Bachelor/Prog2/Prakt2/geomObj/Debug/Rectangle.d @@ -0,0 +1,10 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +Rectangle.d ./Rectangle.o: ../Rectangle.cpp ../Rectangle.h ../Shape.h + +../Rectangle.h: + +../Shape.h: + diff --git a/Bachelor/Prog2/Prakt2/geomObj/Debug/Shape.d b/Bachelor/Prog2/Prakt2/geomObj/Debug/Shape.d new file mode 100644 index 0000000..3ca796d --- /dev/null +++ b/Bachelor/Prog2/Prakt2/geomObj/Debug/Shape.d @@ -0,0 +1,8 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +Shape.d ./Shape.o: ../Shape.cpp ../Shape.h + +../Shape.h: + diff --git a/Bachelor/Prog2/Prakt2/geomObj/Debug/Square.d b/Bachelor/Prog2/Prakt2/geomObj/Debug/Square.d new file mode 100644 index 0000000..15e7998 --- /dev/null +++ b/Bachelor/Prog2/Prakt2/geomObj/Debug/Square.d @@ -0,0 +1,12 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +Square.d ./Square.o: ../Square.cpp ../Square.h ../Rectangle.h ../Shape.h + +../Square.h: + +../Rectangle.h: + +../Shape.h: + diff --git a/Bachelor/Prog2/Prakt2/geomObj/Debug/geomObj b/Bachelor/Prog2/Prakt2/geomObj/Debug/geomObj new file mode 100644 index 0000000..809ba37 Binary files /dev/null and b/Bachelor/Prog2/Prakt2/geomObj/Debug/geomObj differ diff --git a/Bachelor/Prog2/Prakt2/geomObj/Debug/main.d b/Bachelor/Prog2/Prakt2/geomObj/Debug/main.d new file mode 100644 index 0000000..b5a4438 --- /dev/null +++ b/Bachelor/Prog2/Prakt2/geomObj/Debug/main.d @@ -0,0 +1,14 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +main.d ./main.o: ../main.cpp ../Rectangle.h ../Shape.h ../Circle.h ../Square.h + +../Rectangle.h: + +../Shape.h: + +../Circle.h: + +../Square.h: + diff --git a/Bachelor/Prog2/Prakt2/geomObj/Debug/makefile b/Bachelor/Prog2/Prakt2/geomObj/Debug/makefile new file mode 100644 index 0000000..698fd9d --- /dev/null +++ b/Bachelor/Prog2/Prakt2/geomObj/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: geomObj + +geomObj: $(OBJS) + @echo 'Building target: $@' + g++ -o $@ $(OBJS) $(USER_OBJS) $(LIBS) + @echo 'Finished building: $@' + +clean: + -$(RM) $(OBJS) $(DEPS) geomObj + +.PHONY: all clean dependents + +-include $(ROOT)/makefile.targets diff --git a/Bachelor/Prog2/Prakt2/geomObj/Debug/objects.mk b/Bachelor/Prog2/Prakt2/geomObj/Debug/objects.mk new file mode 100644 index 0000000..59a3b5b --- /dev/null +++ b/Bachelor/Prog2/Prakt2/geomObj/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/geomObj/Debug/sources.mk b/Bachelor/Prog2/Prakt2/geomObj/Debug/sources.mk new file mode 100644 index 0000000..357bfc1 --- /dev/null +++ b/Bachelor/Prog2/Prakt2/geomObj/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/geomObj/Debug/subdir.mk b/Bachelor/Prog2/Prakt2/geomObj/Debug/subdir.mk new file mode 100644 index 0000000..f9a4a41 --- /dev/null +++ b/Bachelor/Prog2/Prakt2/geomObj/Debug/subdir.mk @@ -0,0 +1,48 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +S_UPPER_SRCS += \ +${addprefix $(ROOT)/, \ +} + +CPP_SRCS += \ +${addprefix $(ROOT)/, \ +Circle.cpp \ +Rectangle.cpp \ +Shape.cpp \ +Square.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/geomObj/Rectangle.cpp b/Bachelor/Prog2/Prakt2/geomObj/Rectangle.cpp new file mode 100644 index 0000000..cc48ae2 --- /dev/null +++ b/Bachelor/Prog2/Prakt2/geomObj/Rectangle.cpp @@ -0,0 +1,25 @@ +#include "Rectangle.h" + +Rectangle::Rectangle() + :sideA(.0),sideB(.0) +{ +} + +Rectangle::~Rectangle() +{ +} + +Rectangle::Rectangle(double newA, double newB) + :sideA(newA),sideB(newB) +{ +} + +double Rectangle::getCircumference() +{ + return 2 * (sideA + sideB); +} + +double Rectangle::getArea() +{ + return sideA*sideB; +} diff --git a/Bachelor/Prog2/Prakt2/geomObj/Rectangle.h b/Bachelor/Prog2/Prakt2/geomObj/Rectangle.h new file mode 100644 index 0000000..586110a --- /dev/null +++ b/Bachelor/Prog2/Prakt2/geomObj/Rectangle.h @@ -0,0 +1,19 @@ +#ifndef _RECTANGLE_H_ +#define _RECTANGLE_H_ + +#include "Shape.h" + +class Rectangle : public Shape +{ +public: + Rectangle(); + Rectangle(double,double); + virtual ~Rectangle(); + virtual double getArea(); + virtual double getCircumference(); +private: + const double sideA; + const double sideB; +}; + +#endif //_RECTANGLE_H_ diff --git a/Bachelor/Prog2/Prakt2/geomObj/Shape.cpp b/Bachelor/Prog2/Prakt2/geomObj/Shape.cpp new file mode 100644 index 0000000..8eb43e5 --- /dev/null +++ b/Bachelor/Prog2/Prakt2/geomObj/Shape.cpp @@ -0,0 +1,14 @@ +#include "Shape.h" + +Shape::Shape() +{ +} + +Shape::~Shape() +{ +} + +double Shape::operator-(Shape* toSub) +{ + return (this->getArea() - toSub->getArea()); +} diff --git a/Bachelor/Prog2/Prakt2/geomObj/Shape.h b/Bachelor/Prog2/Prakt2/geomObj/Shape.h new file mode 100644 index 0000000..481c2be --- /dev/null +++ b/Bachelor/Prog2/Prakt2/geomObj/Shape.h @@ -0,0 +1,14 @@ +#ifndef _SHAPE_H_ +#define _SHAPE_H_ + +class Shape +{ +public: + Shape(); + virtual ~Shape(); + virtual double getCircumference() = 0; + virtual double getArea() = 0; + double operator-(Shape*); +}; + +#endif //_SHAPE_H_ diff --git a/Bachelor/Prog2/Prakt2/geomObj/Square.cpp b/Bachelor/Prog2/Prakt2/geomObj/Square.cpp new file mode 100644 index 0000000..3bd6682 --- /dev/null +++ b/Bachelor/Prog2/Prakt2/geomObj/Square.cpp @@ -0,0 +1,25 @@ +#include "Square.h" + +Square::Square() + :length(.0) +{ +} + +Square::Square(double newlength) +:length(newlength) +{ +} + +Square::~Square() +{ +} + +double Square::getArea() +{ + return length*length; +} + +double Square::getCircumference() +{ + return 2 * (length + length); +} diff --git a/Bachelor/Prog2/Prakt2/geomObj/Square.h b/Bachelor/Prog2/Prakt2/geomObj/Square.h new file mode 100644 index 0000000..022483b --- /dev/null +++ b/Bachelor/Prog2/Prakt2/geomObj/Square.h @@ -0,0 +1,18 @@ +#ifndef _SQUARE_H_ +#define _SQUARE_H_ + +#include "Rectangle.h" + +class Square : public Rectangle +{ +public: + Square(); + Square(double); + virtual ~Square(); + virtual double getCircumference(); + virtual double getArea(); +private: + const double length; +}; + +#endif //_SQUARE_H_ diff --git a/Bachelor/Prog2/Prakt2/geomObj/geomObj.zip b/Bachelor/Prog2/Prakt2/geomObj/geomObj.zip new file mode 100644 index 0000000..cad5044 Binary files /dev/null and b/Bachelor/Prog2/Prakt2/geomObj/geomObj.zip differ diff --git a/Bachelor/Prog2/Prakt2/geomObj/main.cpp b/Bachelor/Prog2/Prakt2/geomObj/main.cpp new file mode 100644 index 0000000..e81de02 --- /dev/null +++ b/Bachelor/Prog2/Prakt2/geomObj/main.cpp @@ -0,0 +1,39 @@ +#include +#include "Rectangle.h" +#include "Circle.h" +#include "Square.h" + +using std::cout; +using std::endl; + +int main() +{ + Circle circle(15.0); + Rectangle rectangle(3.0,4.0); + Square square(4.2); + + int n,j; + + Shape* ptrArray[3]; + + ptrArray[0]=&circle; + ptrArray[1]=&rectangle; + ptrArray[2]=□ + + for (n=0;n<3;n++) + { + cout << "Area: "<< (ptrArray[n]->getArea()) << " Circumference: " + << (ptrArray[n]->getCircumference()) << endl; + } + + for (n=0;n<3;n++) + { + for (j=0;j<3;j++) + { + cout << "Difference: " + << (ptrArray[j]->getArea() - ptrArray[n]->getArea()) << endl; + } + } + + return 0; +} -- cgit v1.2.3