initial commit
This commit is contained in:
commit
df5f01c123
24 changed files with 2362 additions and 0 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
.metadata/
|
1758
Aufgabeblock_1/.cproject
Normal file
1758
Aufgabeblock_1/.cproject
Normal file
File diff suppressed because it is too large
Load diff
84
Aufgabeblock_1/.project
Normal file
84
Aufgabeblock_1/.project
Normal file
|
@ -0,0 +1,84 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>Aufgabeblock_1</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
|
||||
<triggers>clean,full,incremental,</triggers>
|
||||
<arguments>
|
||||
<dictionary>
|
||||
<key>?name?</key>
|
||||
<value></value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.append_environment</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.autoBuildTarget</key>
|
||||
<value>all</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.buildArguments</key>
|
||||
<value></value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.buildCommand</key>
|
||||
<value>make</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.buildLocation</key>
|
||||
<value>${workspace_loc:/Aufgabeblock_1/Debug}</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
|
||||
<value>clean</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.contents</key>
|
||||
<value>org.eclipse.cdt.make.core.activeConfigSettings</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
|
||||
<value>false</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.enableFullBuild</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.fullBuildTarget</key>
|
||||
<value>all</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.stopOnError</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
|
||||
<triggers>full,incremental,</triggers>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.cdt.core.cnature</nature>
|
||||
<nature>org.eclipse.cdt.core.ccnature</nature>
|
||||
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
|
||||
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
|
||||
<nature>de.innot.avreclipse.core.avrnature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
3
Aufgabeblock_1/.settings/de.innot.avreclipse.core.prefs
Normal file
3
Aufgabeblock_1/.settings/de.innot.avreclipse.core.prefs
Normal file
|
@ -0,0 +1,3 @@
|
|||
#Thu Aug 18 14:08:19 CEST 2011
|
||||
avrtarget/perConfig=false
|
||||
eclipse.preferences.version=1
|
BIN
Aufgabeblock_1/Debug/Aufgabeblock_1
Executable file
BIN
Aufgabeblock_1/Debug/Aufgabeblock_1
Executable file
Binary file not shown.
5
Aufgabeblock_1/Debug/Fahrrad.d
Normal file
5
Aufgabeblock_1/Debug/Fahrrad.d
Normal file
|
@ -0,0 +1,5 @@
|
|||
Fahrrad.d Fahrrad.o: ../Fahrrad.cpp ../Fahrrad.h ../Fahrzeug.h
|
||||
|
||||
../Fahrrad.h:
|
||||
|
||||
../Fahrzeug.h:
|
BIN
Aufgabeblock_1/Debug/Fahrrad.o
Normal file
BIN
Aufgabeblock_1/Debug/Fahrrad.o
Normal file
Binary file not shown.
3
Aufgabeblock_1/Debug/Fahrzeug.d
Normal file
3
Aufgabeblock_1/Debug/Fahrzeug.d
Normal file
|
@ -0,0 +1,3 @@
|
|||
Fahrzeug.d Fahrzeug.o: ../Fahrzeug.cpp ../Fahrzeug.h
|
||||
|
||||
../Fahrzeug.h:
|
BIN
Aufgabeblock_1/Debug/Fahrzeug.o
Normal file
BIN
Aufgabeblock_1/Debug/Fahrzeug.o
Normal file
Binary file not shown.
5
Aufgabeblock_1/Debug/PKW.d
Normal file
5
Aufgabeblock_1/Debug/PKW.d
Normal file
|
@ -0,0 +1,5 @@
|
|||
PKW.d PKW.o: ../PKW.cpp ../PKW.h ../Fahrzeug.h
|
||||
|
||||
../PKW.h:
|
||||
|
||||
../Fahrzeug.h:
|
BIN
Aufgabeblock_1/Debug/PKW.o
Normal file
BIN
Aufgabeblock_1/Debug/PKW.o
Normal file
Binary file not shown.
3
Aufgabeblock_1/Debug/main.d
Normal file
3
Aufgabeblock_1/Debug/main.d
Normal file
|
@ -0,0 +1,3 @@
|
|||
main.d main.o: ../main.cpp ../Fahrzeug.h
|
||||
|
||||
../Fahrzeug.h:
|
BIN
Aufgabeblock_1/Debug/main.o
Normal file
BIN
Aufgabeblock_1/Debug/main.o
Normal file
Binary file not shown.
58
Aufgabeblock_1/Debug/makefile
Normal file
58
Aufgabeblock_1/Debug/makefile
Normal file
|
@ -0,0 +1,58 @@
|
|||
################################################################################
|
||||
# Automatically-generated file. Do not edit!
|
||||
################################################################################
|
||||
|
||||
-include ../makefile.init
|
||||
|
||||
RM := rm -rf
|
||||
|
||||
# All of the sources participating in the build are defined here
|
||||
-include sources.mk
|
||||
-include subdir.mk
|
||||
-include objects.mk
|
||||
|
||||
ifneq ($(MAKECMDGOALS),clean)
|
||||
ifneq ($(strip $(C++_DEPS)),)
|
||||
-include $(C++_DEPS)
|
||||
endif
|
||||
ifneq ($(strip $(C_DEPS)),)
|
||||
-include $(C_DEPS)
|
||||
endif
|
||||
ifneq ($(strip $(CC_DEPS)),)
|
||||
-include $(CC_DEPS)
|
||||
endif
|
||||
ifneq ($(strip $(CPP_DEPS)),)
|
||||
-include $(CPP_DEPS)
|
||||
endif
|
||||
ifneq ($(strip $(CXX_DEPS)),)
|
||||
-include $(CXX_DEPS)
|
||||
endif
|
||||
ifneq ($(strip $(C_UPPER_DEPS)),)
|
||||
-include $(C_UPPER_DEPS)
|
||||
endif
|
||||
endif
|
||||
|
||||
-include ../makefile.defs
|
||||
|
||||
# Add inputs and outputs from these tool invocations to the build variables
|
||||
|
||||
# All Target
|
||||
all: Aufgabeblock_1
|
||||
|
||||
# Tool invocations
|
||||
Aufgabeblock_1: $(OBJS) $(USER_OBJS)
|
||||
@echo 'Building target: $@'
|
||||
@echo 'Invoking: GCC C++ Linker'
|
||||
g++ -o"Aufgabeblock_1" $(OBJS) $(USER_OBJS) $(LIBS)
|
||||
@echo 'Finished building target: $@'
|
||||
@echo ' '
|
||||
|
||||
# Other Targets
|
||||
clean:
|
||||
-$(RM) $(OBJS)$(C++_DEPS)$(C_DEPS)$(CC_DEPS)$(CPP_DEPS)$(EXECUTABLES)$(CXX_DEPS)$(C_UPPER_DEPS) Aufgabeblock_1
|
||||
-@echo ' '
|
||||
|
||||
.PHONY: all clean dependents
|
||||
.SECONDARY:
|
||||
|
||||
-include ../makefile.targets
|
8
Aufgabeblock_1/Debug/objects.mk
Normal file
8
Aufgabeblock_1/Debug/objects.mk
Normal file
|
@ -0,0 +1,8 @@
|
|||
################################################################################
|
||||
# Automatically-generated file. Do not edit!
|
||||
################################################################################
|
||||
|
||||
USER_OBJS :=
|
||||
|
||||
LIBS :=
|
||||
|
27
Aufgabeblock_1/Debug/sources.mk
Normal file
27
Aufgabeblock_1/Debug/sources.mk
Normal file
|
@ -0,0 +1,27 @@
|
|||
################################################################################
|
||||
# Automatically-generated file. Do not edit!
|
||||
################################################################################
|
||||
|
||||
O_SRCS :=
|
||||
CPP_SRCS :=
|
||||
C_UPPER_SRCS :=
|
||||
C_SRCS :=
|
||||
S_UPPER_SRCS :=
|
||||
OBJ_SRCS :=
|
||||
ASM_SRCS :=
|
||||
CXX_SRCS :=
|
||||
C++_SRCS :=
|
||||
CC_SRCS :=
|
||||
OBJS :=
|
||||
C++_DEPS :=
|
||||
C_DEPS :=
|
||||
CC_DEPS :=
|
||||
CPP_DEPS :=
|
||||
EXECUTABLES :=
|
||||
CXX_DEPS :=
|
||||
C_UPPER_DEPS :=
|
||||
|
||||
# Every subdirectory with source files must be described here
|
||||
SUBDIRS := \
|
||||
. \
|
||||
|
33
Aufgabeblock_1/Debug/subdir.mk
Normal file
33
Aufgabeblock_1/Debug/subdir.mk
Normal file
|
@ -0,0 +1,33 @@
|
|||
################################################################################
|
||||
# Automatically-generated file. Do not edit!
|
||||
################################################################################
|
||||
|
||||
# Add inputs and outputs from these tool invocations to the build variables
|
||||
CPP_SRCS += \
|
||||
../Fahrrad.cpp \
|
||||
../Fahrzeug.cpp \
|
||||
../PKW.cpp \
|
||||
../main.cpp
|
||||
|
||||
OBJS += \
|
||||
./Fahrrad.o \
|
||||
./Fahrzeug.o \
|
||||
./PKW.o \
|
||||
./main.o
|
||||
|
||||
CPP_DEPS += \
|
||||
./Fahrrad.d \
|
||||
./Fahrzeug.d \
|
||||
./PKW.d \
|
||||
./main.d
|
||||
|
||||
|
||||
# Each subdirectory must supply rules for building sources it contributes
|
||||
%.o: ../%.cpp
|
||||
@echo 'Building file: $<'
|
||||
@echo 'Invoking: GCC C++ Compiler'
|
||||
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<"
|
||||
@echo 'Finished building: $<'
|
||||
@echo ' '
|
||||
|
||||
|
40
Aufgabeblock_1/Fahrrad.cpp
Normal file
40
Aufgabeblock_1/Fahrrad.cpp
Normal file
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* Fahrrad.cpp
|
||||
*
|
||||
* Created on: 18.08.2011
|
||||
* Author: stv0g
|
||||
*/
|
||||
|
||||
#include "Fahrrad.h"
|
||||
|
||||
Fahrrad::Fahrrad() {
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
Fahrrad::~Fahrrad() {
|
||||
// TODO Auto-generated destructor stub
|
||||
}
|
||||
|
||||
double Fahrrad::dGeschwindigkeit() {
|
||||
double dFahrradGeschwindigkeit = p_dMaxGeschwindigkeit;
|
||||
int iReduzierung = (int) p_dGesamtStrecke / 20;
|
||||
|
||||
for (int i = 0; i < iReduzierung; i++) {
|
||||
dFahrradGeschwindigkeit *= 0.9;
|
||||
}
|
||||
|
||||
if (dFahrradGeschwindigkeit < 12) {
|
||||
dFahrradGeschwindigkeit = 12;
|
||||
}
|
||||
|
||||
return dFahrradGeschwindigkeit;
|
||||
}
|
||||
|
||||
static Fahrrad * Fahrrad::erzeuge(string sName, double dMaxGeschwindigkeit) {
|
||||
Fahrrad *rad = new Fahrrad(sName);
|
||||
|
||||
rad->p_dMaxGeschwindigkeit = dMaxGeschwindigkeit;
|
||||
|
||||
return rad;
|
||||
}
|
||||
|
26
Aufgabeblock_1/Fahrrad.h
Normal file
26
Aufgabeblock_1/Fahrrad.h
Normal file
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* Fahrrad.h
|
||||
*
|
||||
* Created on: 18.08.2011
|
||||
* Author: stv0g
|
||||
*/
|
||||
|
||||
#ifndef FAHRRAD_H_
|
||||
#define FAHRRAD_H_
|
||||
|
||||
#include "Fahrzeug.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
class Fahrrad: public Fahrzeug {
|
||||
public:
|
||||
Fahrrad();
|
||||
virtual ~Fahrrad();
|
||||
|
||||
double dGeschwindigkeit();
|
||||
void vAusgabe();
|
||||
|
||||
static Fahrrad * erzeuge(string sName, double dMaxGeschwindigkeit);
|
||||
};
|
||||
|
||||
#endif /* FAHRRAD_H_ */
|
63
Aufgabeblock_1/Fahrzeug.cpp
Normal file
63
Aufgabeblock_1/Fahrzeug.cpp
Normal file
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
* Fahrzeug.cpp
|
||||
*
|
||||
* Created on: 18.08.2011
|
||||
* Author: stv0g
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cmath>
|
||||
|
||||
#include "Fahrzeug.h"
|
||||
|
||||
extern double dGlobaleZeit;
|
||||
|
||||
int Fahrzeug::p_iMaxID = 0;
|
||||
|
||||
Fahrzeug::Fahrzeug() {
|
||||
vInitialisierung();
|
||||
//cout << this->p_sName << ":" << this->p_iID << " wurde initialisiert" << endl;
|
||||
}
|
||||
|
||||
Fahrzeug::Fahrzeug(string sName) {
|
||||
vInitialisierung();
|
||||
p_sName = sName;
|
||||
|
||||
//cout << this->p_sName << ":" << this->p_iID << " wurde initialisiert" << endl;
|
||||
}
|
||||
|
||||
Fahrzeug::~Fahrzeug() {
|
||||
//cout << this->p_sName << ":" << this->p_iID << " wurde gelöscht" << endl;
|
||||
}
|
||||
|
||||
void Fahrzeug::vInitialisierung() {
|
||||
p_iID = ++p_iMaxID;
|
||||
|
||||
p_sName = " ";
|
||||
p_dMaxGeschwindigkeit = 0;
|
||||
p_dGesamtStrecke = 0;
|
||||
p_dGesamtZeit = 0;
|
||||
p_dZeit = 0;
|
||||
}
|
||||
|
||||
void Fahrzeug::vAusgabe() {
|
||||
cout << setprecision(2) << setiosflags(ios::fixed)
|
||||
<< resetiosflags(ios::right) << setiosflags(ios::left)
|
||||
<< setw(4) << this->p_iID
|
||||
<< setw(7) << this->p_sName << ": "
|
||||
<< resetiosflags(ios::left) << setiosflags(ios::right)
|
||||
<< setw(7) << p_dMaxGeschwindigkeit
|
||||
<< setw(12) << p_dGesamtStrecke
|
||||
<< endl;
|
||||
}
|
||||
|
||||
void Fahrzeug::vAbfertigung() {
|
||||
if (fabs(p_dZeit - dGlobaleZeit) < 1e-10) return;
|
||||
|
||||
double dDelta = dGlobaleZeit - p_dZeit;
|
||||
|
||||
p_dGesamtZeit += dDelta;
|
||||
p_dGesamtStrecke += dGeschwindigkeit() * dDelta;
|
||||
p_dZeit = dGlobaleZeit;
|
||||
}
|
40
Aufgabeblock_1/Fahrzeug.h
Normal file
40
Aufgabeblock_1/Fahrzeug.h
Normal file
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* Fahrzeug.h
|
||||
*
|
||||
* Created on: 18.08.2011
|
||||
* Author: stv0g
|
||||
*/
|
||||
|
||||
#ifndef FAHRZEUG_H_
|
||||
#define FAHRZEUG_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
using namespace std;
|
||||
|
||||
class Fahrzeug {
|
||||
public:
|
||||
Fahrzeug();
|
||||
Fahrzeug(string sName);
|
||||
virtual ~Fahrzeug();
|
||||
|
||||
void vAusgabe();
|
||||
virtual void vAbfertigung();
|
||||
virtual double dTanken(double dMenge) { return 0; }; /* Kraftfahrzeuge überladen dTanken() */
|
||||
virtual double dGeschwindigkeit() { return p_dMaxGeschwindigkeit; }
|
||||
|
||||
protected:
|
||||
int p_iID;
|
||||
std::string p_sName;
|
||||
double p_dMaxGeschwindigkeit;
|
||||
double p_dGesamtStrecke;
|
||||
double p_dGesamtZeit;
|
||||
double p_dZeit;
|
||||
|
||||
private:
|
||||
static int p_iMaxID;
|
||||
|
||||
void vInitialisierung();
|
||||
};
|
||||
|
||||
#endif /* FAHRZEUG_H_ */
|
81
Aufgabeblock_1/PKW.cpp
Normal file
81
Aufgabeblock_1/PKW.cpp
Normal file
|
@ -0,0 +1,81 @@
|
|||
/*
|
||||
* PKW.cpp
|
||||
*
|
||||
* Created on: 18.08.2011
|
||||
* Author: stv0g
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
|
||||
#include "PKW.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
extern double dGlobaleZeit;
|
||||
|
||||
PKW::PKW(string sName, double dVerbrauch, double dTankvolumen = 55) :
|
||||
Fahrzeug(sName),
|
||||
p_dVerbrauch(dVerbrauch),
|
||||
p_dTankvolumen(dTankvolumen),
|
||||
p_dTankinhalt(dTankvolumen/2) { }
|
||||
|
||||
PKW::PKW(double dVerbrauch, double dTankvolumen = 55) :
|
||||
Fahrzeug(),
|
||||
p_dVerbrauch(dVerbrauch),
|
||||
p_dTankvolumen(dTankvolumen),
|
||||
p_dTankinhalt(dTankvolumen/2) { }
|
||||
|
||||
PKW::~PKW() {
|
||||
// TODO Auto-generated destructor stub
|
||||
}
|
||||
|
||||
double PKW::dTanken(double dMenge = 0) {
|
||||
double dAlterInhalt = p_dTankinhalt;
|
||||
|
||||
if (dMenge == 0) {
|
||||
p_dTankinhalt = p_dTankvolumen;
|
||||
}
|
||||
else {
|
||||
p_dTankinhalt += dMenge;
|
||||
if (p_dTankinhalt > p_dTankvolumen) {
|
||||
p_dTankinhalt = p_dTankvolumen; /* Verhindere Überfüllung */
|
||||
}
|
||||
}
|
||||
|
||||
return p_dTankinhalt - dAlterInhalt;
|
||||
}
|
||||
|
||||
void PKW::vAbfertigung() {
|
||||
if (p_dTankinhalt > 0) { /* prüfen, ob etwas im Tank ist */
|
||||
p_dTankinhalt -= (dGlobaleZeit - p_dZeit) * p_dMaxGeschwindigkeit * p_dVerbrauch / 100;
|
||||
if (p_dTankinhalt < 0) { /* falls Tankinhalt negativ ist */
|
||||
p_dTankinhalt = 0;
|
||||
}
|
||||
Fahrzeug::vAbfertigung();
|
||||
}
|
||||
else {
|
||||
p_dTankinhalt = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void PKW::vAusgabe() {
|
||||
Fahrzeug::vAusgabe();
|
||||
|
||||
cout << setprecision(2) << setiosflags(ios::fixed)
|
||||
<< resetiosflags(ios::left) << setiosflags(ios::right)
|
||||
<< setw(7) << dVerbrauch()
|
||||
<< setw(7) << p_dTankinhalt << endl;
|
||||
}
|
||||
|
||||
double PKW::dVerbrauch() {
|
||||
return p_dGesamtStrecke * p_dVerbrauch / 100;
|
||||
}
|
||||
|
||||
static PKW * PKW::erzeuge(string sName, double dMaxGeschwindigkeit) {
|
||||
Fahrrad *rad = new Fahrrad(sName);
|
||||
|
||||
rad->p_dMaxGeschwindigkeit = dMaxGeschwindigkeit;
|
||||
|
||||
return rad;
|
||||
}
|
34
Aufgabeblock_1/PKW.h
Normal file
34
Aufgabeblock_1/PKW.h
Normal file
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* PKW.h
|
||||
*
|
||||
* Created on: 18.08.2011
|
||||
* Author: stv0g
|
||||
*/
|
||||
|
||||
#ifndef PKW_H_
|
||||
#define PKW_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "Fahrzeug.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
class PKW: public Fahrzeug {
|
||||
private:
|
||||
double p_dVerbrauch;
|
||||
double p_dTankinhalt;
|
||||
double p_dTankvolumen;
|
||||
|
||||
public:
|
||||
PKW(string sName, double dTankvolumen);
|
||||
PKW(double dTankvolumen);
|
||||
virtual ~PKW();
|
||||
|
||||
void vAbfertigung();
|
||||
void vAusgabe();
|
||||
double dVerbrauch();
|
||||
double dTanken(double dMenge);
|
||||
};
|
||||
|
||||
#endif /* PKW_H_ */
|
90
Aufgabeblock_1/main.cpp
Normal file
90
Aufgabeblock_1/main.cpp
Normal file
|
@ -0,0 +1,90 @@
|
|||
/*
|
||||
* main.cpp
|
||||
*
|
||||
* Created on: 18.08.2011
|
||||
* Author: stv0g
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
#include "Fahrzeug.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
double dGlobaleZeit = 0.0;
|
||||
|
||||
void vAufgabe1() {
|
||||
/* 3. Initialisieren */
|
||||
Fahrzeug fz1("Porsche");
|
||||
Fahrzeug *fz2 = new Fahrzeug();
|
||||
|
||||
string name;
|
||||
cout << "Bitte geben Sie einen Fahrzeugnamen ein: ";
|
||||
cin >> name;
|
||||
|
||||
Fahrzeug *fz3 = new Fahrzeug(name);
|
||||
|
||||
/* 5. Ausgabe */
|
||||
cout << endl << "ID Name : MaxKmh GesamtStrecke" << endl;
|
||||
cout << "++++++++++++++++++++++++++++++++++++++++++" << endl;
|
||||
fz1.vAusgabe();
|
||||
fz2->vAusgabe();
|
||||
fz3->vAusgabe();
|
||||
|
||||
/* 9. Abfertigung */
|
||||
double dAbfertigungsIntervall;
|
||||
cout << endl << "Bitte geben Sie ein Abfertigungsintervall ein: ";
|
||||
cin >> dAbfertigungsIntervall;
|
||||
|
||||
cout << endl << "ID Name : MaxKmh GesamtStrecke" << endl;
|
||||
cout << "++++++++++++++++++++++++++++++++++++++++++" << endl;
|
||||
for (; dGlobaleZeit < 24; dGlobaleZeit += dAbfertigungsIntervall) { /* simuliere für einen Tag */
|
||||
fz1.vAbfertigung();
|
||||
fz2->vAbfertigung();
|
||||
fz3->vAbfertigung();
|
||||
|
||||
cout << "globale Zeit: " << dGlobaleZeit << endl;
|
||||
fz1.vAusgabe();
|
||||
fz2->vAusgabe();
|
||||
fz3->vAusgabe();
|
||||
}
|
||||
|
||||
delete fz2;
|
||||
delete fz3;
|
||||
}
|
||||
|
||||
void vAufgabe1_deb() {
|
||||
Fahrzeug fz1("Opel");
|
||||
Fahrzeug fz2("Benz");
|
||||
Fahrzeug fz3("Ferrari");
|
||||
Fahrzeug fz4("Mini");
|
||||
|
||||
Fahrzeug *feld_name[4] = {&fz1, &fz2, &fz3, &fz4};
|
||||
|
||||
feld_name[2] = 0;
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
feld_name[i]->vAusgabe();
|
||||
}
|
||||
}
|
||||
|
||||
void vAufgabe2() {
|
||||
int iAnzahl;
|
||||
vector<Fahrzeug *> fahrzeuge;
|
||||
|
||||
cout << "Wie viele Fahrzeuge möchten Sie erstellen? ";
|
||||
cin >> iAnzahl;
|
||||
|
||||
for (int j = 0; j < i; j++) {
|
||||
fahrzeuge.push(Fahrrad::erzeuge());
|
||||
}
|
||||
}
|
||||
|
||||
int main() {
|
||||
//vAufgabe1();
|
||||
//vAufgabe1_deb();
|
||||
vAugabe2();
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Reference in a new issue