24 Commits
Author SHA1 Message Date
kachelto100370 d8425f268b bin dumm und hab 2 unötige commits gemacht, hier ist das wirklich drinnen 2026-05-27 11:04:39 +02:00
kachelto100370 187ccdc6a5 Merge branch 'main' into A6 2026-05-14 23:22:20 +02:00
kachelto100370 3e50fa9c4d alles funktioniert, refactoring noch möglich 2026-05-14 16:23:33 +02:00
kachelto100370 12eaaaa18d alle funktion definiert glaub ich 2026-05-14 11:11:15 +02:00
kachelto100370 cf97b0ac1e alle Test laufen durch 2026-05-12 17:41:40 +02:00
kachelto100370 9f0b35451b falscher branch :( 2026-05-12 15:19:30 +02:00
kachelto100370 3b94f5d1b1 angefangen, hab schon mal alle dateien erstellt 2026-05-10 19:03:07 +02:00
kachelto100370 fada2730bf added all missing functionis 2026-05-09 15:46:45 +02:00
kachelto100370 b636977ccd alle methoden die ich brauche sind deklariert 2026-05-07 16:53:07 +02:00
kachelto100370 09c8ca75fe bin auf falschen branch, sollte A5 sein 2026-05-07 16:48:59 +02:00
kachelto100370 a7a85287d0 Abgabe 2,3,4, noch den letzten schliff gegeben 2026-04-24 09:21:07 +02:00
kachelto100370 2b46522a4d Aufgabe 4 fertig 2026-04-24 02:34:36 +02:00
kachelto100370 643c524d1b Aufgabe 3 fertig 2026-04-24 01:03:08 +02:00
kachelto100370 3b1a8af39d bissl Fortschritt, ich will aber erst Aufg 3 machen 2026-04-23 15:07:56 +02:00
kachelto100370 be77aebb25 Aufgabe 2 fertig 2026-04-22 14:50:04 +02:00
kachelto100370 7618246a5b Glaube flugkurve01.cpp ist fertig, ich hoffe ich muss nur noch die .h ändern 2026-04-21 23:35:18 +02:00
kachelto100370 78de564416 Aufg. 2, 2/4 Funktionen implementiert, .h datei erstellt 2026-04-19 16:58:13 +02:00
kachelto100370 7ae37fad48 Aufgabe 1 fertig, wurde schon korrigiert 2026-04-19 13:27:50 +02:00
kachelto100370 5d78ae3349 hab 1 augabe fertig, bin zu dumm das auf windows zu kompilieren deswegen mal schauen 2026-04-09 17:09:13 +02:00
kachelto100370 5fa8a68108 aufgabenstellung erfüllt, muss noch die funktionen richtig machen 2026-04-08 12:42:15 +02:00
kachelto100370 08d8778929 Vorbereitungsaufgaben sind fertig 2026-04-07 16:38:08 +02:00
kachelto100370 762dd4df86 snapshot bevor ich das Programm auf 3 dimenstionen erweitere 2026-03-26 23:46:54 +01:00
kachelto100370 382203559c präprozessor und linkerfehler gefixt 2026-03-26 14:40:22 +01:00
kachelto100370 c8490df248 fehlerprogramme geschrieben 2026-03-25 14:44:13 +01:00
57 changed files with 552 additions and 119 deletions

No files matched your search

+4
View File
@@ -0,0 +1,4 @@
1_Grundlagen/code/matrix.exe
.out
.exe
.a
+28
View File
@@ -0,0 +1,28 @@
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: x86_64-w64-mingw32-gcc.exe build active file",
"command": "c:\\Users\\tobis\\mingw64\\bin\\x86_64-w64-mingw32-gcc.exe",
"args": [
"-fdiagnostics-color=always",
"-g",
"${file}",
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe"
],
"options": {
"cwd": "c:\\Users\\tobis\\mingw64\\bin"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Task generated by Debugger."
}
],
"version": "2.0.0"
}
+28
View File
@@ -0,0 +1,28 @@
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: g++ build active file",
"command": "/usr/bin/g++",
"args": [
"-fdiagnostics-color=always",
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Task generated by Debugger."
}
],
"version": "2.0.0"
}
@@ -0,0 +1,15 @@
#table(
columns: (1fr, auto, auto),
inset: 10pt,
align: horizon,
table.header(
[*Adresse*], [*Inhalt an der Adresse*], [Name der Variablen],
),
`0x7fffffffd7d8`,
\&int\*\*,
matrix,
`0x7fffffffd938`,
\&uadf,
matrix[0]
)
Binary file not shown.
@@ -0,0 +1,5 @@
#include <iostream>
int main(){
std::cout << "Hello, World!";
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,8 @@
#include <iostream>
using namespace std;
int main(){
int array[3] = {0, 1, 2};
for (int i = 0; i < 10; i++){
cout << array[i] << "\n";
}
}
@@ -0,0 +1,48 @@
.file "laufzeitfehler.cpp"
.text
#APP
.globl _ZSt21ios_base_library_initv
.section .rodata
.LC0:
.string "\n"
#NO_APP
.text
.globl main
.type main, @function
main:
.LFB1984:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
subq $16, %rsp
movl $0, -16(%rbp)
movl $1, -12(%rbp)
movl $2, -8(%rbp)
movl $0, -4(%rbp)
jmp .L2
.L3:
movl -4(%rbp), %eax
cltq
movl -16(%rbp,%rax,4), %eax
movl %eax, %esi
movl $_ZSt4cout, %edi
call _ZNSolsEi
movl $.LC0, %esi
movq %rax, %rdi
call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
addl $1, -4(%rbp)
.L2:
cmpl $9, -4(%rbp)
jle .L3
movl $0, %eax
leave
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE1984:
.size main, .-main
.ident "GCC: (GNU) 15.2.1 20260123 (Red Hat 15.2.1-7)"
.section .note.GNU-stack,"",@progbits
@@ -0,0 +1,3 @@
int addtwo(int s1, int s2)
{}
@@ -0,0 +1,9 @@
void addtwo();
int main(){
int a = 1;
int b = 2;
addtwo();
}
@@ -0,0 +1,5 @@
#include <link.h>
int add(int s1, int s2){
return s1 + s2;
}
Binary file not shown.
@@ -0,0 +1,9 @@
#define NUM 0
using namespace std;
int main(){
int i;
i = NUM;
cout << i << "\n" ;
}
@@ -0,0 +1,3 @@
#pragma once
#define NUM
Binary file not shown.

After

Width:  |  Height:  |  Size: 105 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
+42 -27
View File
@@ -1,34 +1,49 @@
#include<stdio.h>
#include<stdlib.h>
#include <stdio.h>
#include <stdlib.h>
#include "matrix.h"
int main()
int ***build_matrix(int nx, int ny, int nz)
{
const int nx=3;
const int ny=2;
int** matrix;
matrix = (int**)malloc(ny*sizeof(int*));
for(int y=0; y<ny; y++)
int ***matrix = (int ***)malloc(nz * sizeof(int **));
for (int z = 0; z < nz; z++)
{
matrix[y] = (int*)malloc(nx*sizeof(int));
for(int x=0; x<nx; x++)
matrix[z] = (int **)malloc(ny * sizeof(int *));
for (int y = 0; y < ny; y++)
{
matrix[y][x] = (y+1)*10 + x+1;
matrix[z][y] = (int *)malloc(nx * sizeof(int));
for (int x = 0; x < nx; x++)
{
matrix[z][y][x] = (z + 1) * 100 + (y + 1) * 10 + x + 1;
}
}
}
for(int y=0; y<ny; y++)
{
for(int x=0; x<nx; x++)
{
printf("%i ",matrix[y][x]);
}
printf("\n");
}
for(int y=0; y<ny; y++)
{
free(matrix[y]);
}
free(matrix);
return matrix;
}
void print_matrix(int ***matrix, int nx, int ny, int nz)
{
for (int z = 0; z < nz; z++)
{
for (int y = 0; y < ny; y++)
{
for (int x = 0; x < nx; x++)
{
printf("%i ", matrix[z][y][x]);
}
printf("\n");
}
}
}
void free_matrix(int ***matrix, int ny, int nz)
{
for (int z = 0; z < nz; z++)
{
for (int y = 0; y < ny; y++)
{
free(matrix[z][y]);
}
free(matrix[z]);
}
free(matrix);
}
+6
View File
@@ -0,0 +1,6 @@
#pragma once
int ***build_matrix(int nx, int ny, int nz);
void print_matrix(int ***matrix, int nx, int ny, int nz);
void free_matrix(int ***matrix, int ny, int nz);
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+31 -38
View File
@@ -1,45 +1,38 @@
#include "flugkurve01.h"
#include <iostream>
using namespace std;
int main()
{
// Körper:
float masse = 10; // [kg]
float xPosition = 0; // [m]
float yPosition = 0; // [m]
float xGeschwindigkeit = 10; // [m/s]
float yGeschwindigkeit = 10; // [m/s]
Vektor mulVektor(Vektor vec, float num) {
Vektor ergebnis = {vec.x * num, vec.y * num};
return ergebnis;
}
// Parametrierung der auf den Körper wirkende Kräfte:
const float X_BESCHLEUNIGUNG_GRAVITATION = 0; // [m/s^2]
const float Y_BESCHLEUNIGUNG_GRAVITATION = -9.81; // [m/s^2]
const float REIBUNGSKOEFFIZIENT = -5; // [kg/s]
// Sorgt dafür, dass 2 Nachkommastellen angezeigt werden:
cout << fixed;
cout.precision(2);
// Simulation:
const float dt = 0.1; // [s]
for(;;)
{
cout << "(" << xPosition << "," << yPosition << ")" << endl;
Vektor addVektor(Vektor vec1, Vektor vec2) {
Vektor erg = {vec1.x + vec2.x, vec1.y + vec2.y};
return erg;
}
// Berechnung der Beschleunigung aus der Kraft
float xBeschleunigung = xGeschwindigkeit * REIBUNGSKOEFFIZIENT / masse + X_BESCHLEUNIGUNG_GRAVITATION;
float yBeschleunigung = yGeschwindigkeit * REIBUNGSKOEFFIZIENT / masse + Y_BESCHLEUNIGUNG_GRAVITATION;
// Ermittlung der neuen Geschwindigkeit
xGeschwindigkeit += dt * xBeschleunigung;
yGeschwindigkeit += dt * yBeschleunigung;
Koerper bewegeKoerper(Koerper korp, Vektor gesamtkraft, float dt) {
// Ermittlung der neuen Position
xPosition += dt * xGeschwindigkeit;
yPosition += dt * yGeschwindigkeit;
if(yPosition<=0)
{
break;
}
}
// Berechnung der Beschleunigung aus der Kraft
float xBeschleunigung = gesamtkraft.x / korp.masse;
float yBeschleunigung = gesamtkraft.y / korp.masse;
// Ermittlung der neuen Geschwindigkeit
korp.geschwindigkeit.x += dt * xBeschleunigung;
korp.geschwindigkeit.y += dt * yBeschleunigung;
// Ermittlung der neuen Position
korp.position.x += dt * korp.geschwindigkeit.x;
korp.position.y += dt * korp.geschwindigkeit.y;
return korp;
}
void ausgabeKoerper(Koerper korp){
cout << "x = " << korp.position.x << "y = " << korp.position.y;
}
void ausgabeVektor(Vektor vec){
cout << "x = " << vec.x << endl;
cout << "y = " << vec.y << endl;
}
+19
View File
@@ -0,0 +1,19 @@
#pragma once
// Parametrierung der auf den Körper wirkende Kräfte:
struct Vektor {
float x; // [m/s^2]
float y; // [m/s^2]
};
// Körper:
struct Koerper {
float masse; // [kg]
Vektor position;
Vektor geschwindigkeit;
};
Vektor addVektor(Vektor vec1, Vektor vec2);
Vektor mulVektor(Vektor vec, float skalar);
Koerper bewegeKoerper(Koerper korp, Vektor gesamtkraft, float dt);
void ausgabeKoerper(Koerper korp);
void ausgabeVektor(Vektor vec);
+9
View File
@@ -0,0 +1,9 @@
const float* const wert
Welche Bedeuting haben das erste und zweite const?
1. const: es ist ein konstanter float
2. const: es ist ein konstanter zeiger
Welchen Nutzen könnte die Verwendung von const an den beiden Stellen bieten?
An der 1. Stelle: sichergehen, dass der Wert mit den gearbeitet wird nicht geändert wird
An der 2. Stelle: sichergehen, dass der Zeiger nicht auf etwas anderes zeigt, womit sich der Wert ändern würde.
BIN
View File
Binary file not shown.
+22 -7
View File
@@ -1,10 +1,25 @@
#include <stdio.h>
#include "summe.h"
#include <iostream>
#include <vector>
int main()
{
const int N = 4;
const float daten[N] = {1.0f,2.0f,3.0f,4.0f};
float summe = berechneSumme(daten,N);
printf("Summe = %f\n", summe);
int main() {
/* const int N = 4;
const float daten[N] = {1.0f,2.0f,3.0f,4.0f};
float summe = berechneSumme(daten,N);
printf("Summe = %f\n", summe); */
string name;
int anzahlSummanten;
int hilfvar;
vector<int> summanten;
cout << "Was ist dein Name?" << endl;
cin >> name;
cout << "Hallo " << name << ", Wie viele Zahlen willst du addieren?" << endl;
cin >> anzahlSummanten;
for (int i = 0; i < anzahlSummanten; i++) {
cout << "Der " << i + 1 << ". Summant ist:" << endl;
cin >> hilfvar;
summanten.push_back(hilfvar);
}
cout << name << ", die Summe ist: " << berechneSumme(summanten) << endl;
cout << "Auf Wiedersehen " << name << endl;
}
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+10 -5
View File
@@ -1,8 +1,13 @@
#include "summe.h"
float berechneSumme(const float* const wert, int anzahlWerte)
{
return (anzahlWerte) ? *wert+berechneSumme(wert+1, anzahlWerte-1) : 0;
/* float berechneSumme(const float *const wert, int anzahlWerte) {
return (anzahlWerte) ? *wert + berechneSumme(wert + 1, anzahlWerte - 1) : 0;
} */
int berechneSumme(vector<int> myvector) {
int summe;
for (unsigned int i = 0; i < myvector.size(); i++) {
summe += myvector[i];
}
return summe;
}
+3 -1
View File
@@ -1,6 +1,8 @@
#ifndef __SUMME_H
#define __SUMME_H
#include <vector>
using namespace std;
/**
* Berechnet die Summe ueber eine Menge von Werten.
* @param wert Werte
@@ -8,5 +10,5 @@
* @return Summe
*/
float berechneSumme(const float* const wert, int anzahlWerte);
int berechneSumme(vector<int> myvector);
#endif
BIN
View File
Binary file not shown.
+1
View File
@@ -30,6 +30,7 @@ void function_checks() {
assert(fabs(koerper.geschwindigkeit.x - 10.7) < 0.1 && "Result must be 10.7");
assert(fabs(koerper.geschwindigkeit.y - 9.3) < 0.1 && "Result must be 9.3");
assert(fabs(koerper.position.x - 74.9) < 0.1 && "Result must be 74.9");
cout << koerper.position.y << endl;
assert(fabs(koerper.position.y - 65.1) < 0.1 && "Result must be 65.1");
cout << "bewegeKoerper erfolgreich" << endl;
}
+31 -38
View File
@@ -1,45 +1,38 @@
#include "flugkurve02.h"
#include <iostream>
using namespace std;
int main()
{
// Körper:
float masse = 10; // [kg]
float xPosition = 0; // [m]
float yPosition = 0; // [m]
float xGeschwindigkeit = 10; // [m/s]
float yGeschwindigkeit = 10; // [m/s]
Vektor mulVektor(const Vektor &vec, const float &skalar){
Vektor ergebnis = {vec.x * skalar, vec.y * skalar};
return ergebnis;
}
// Parametrierung der auf den Körper wirkende Kräfte:
const float X_BESCHLEUNIGUNG_GRAVITATION = 0; // [m/s^2]
const float Y_BESCHLEUNIGUNG_GRAVITATION = -9.81; // [m/s^2]
const float REIBUNGSKOEFFIZIENT = -5; // [kg/s]
// Sorgt dafür, dass 2 Nachkommastellen angezeigt werden:
cout << fixed;
cout.precision(2);
// Simulation:
const float dt = 0.1; // [s]
for(;;)
{
cout << "(" << xPosition << "," << yPosition << ")" << endl;
Vektor addVektor(const Vektor &vec1, const Vektor &vec2) {
Vektor erg = {vec1.x + vec2.x, vec1.y + vec2.y};
return erg;
}
// Berechnung der Beschleunigung aus der Kraft
float xBeschleunigung = xGeschwindigkeit * REIBUNGSKOEFFIZIENT / masse + X_BESCHLEUNIGUNG_GRAVITATION;
float yBeschleunigung = yGeschwindigkeit * REIBUNGSKOEFFIZIENT / masse + Y_BESCHLEUNIGUNG_GRAVITATION;
// Ermittlung der neuen Geschwindigkeit
xGeschwindigkeit += dt * xBeschleunigung;
yGeschwindigkeit += dt * yBeschleunigung;
Koerper bewegeKoerper(const Koerper &korp, const Vektor &gesamtkraft,const float &dt) {
Koerper erg = {0, {0,0}, {0,0}};
// Berechnung der Beschleunigung aus der Kraft
const float xBeschleunigung = gesamtkraft.x / korp.masse;
const float yBeschleunigung = gesamtkraft.y / korp.masse;
// Ermittlung der neuen Position
xPosition += dt * xGeschwindigkeit;
yPosition += dt * yGeschwindigkeit;
if(yPosition<=0)
{
break;
}
}
// Ermittlung der neuen Geschwindigkeit
erg.geschwindigkeit.x = korp.geschwindigkeit.x + dt * xBeschleunigung;
erg.geschwindigkeit.y = korp.geschwindigkeit.y + dt * yBeschleunigung;
// Ermittlung der neuen Position
erg.position.x += korp.position.x + dt * erg.geschwindigkeit.x;
erg.position.y += korp.position.y + dt * erg.geschwindigkeit.y;
return erg;
}
void ausgabeKoerper(const Koerper &korp){
cout << "x = " << korp.position.x << "y = " << korp.position.y;
}
void ausgabeVektor(const Vektor &vec){
cout << "x = " << vec.x << endl;
cout << "y = " << vec.y << endl;
}
+19
View File
@@ -0,0 +1,19 @@
#pragma once
// Parametrierung der auf den Körper wirkende Kräfte:
struct Vektor {
float x; // [m/s^2]
float y; // [m/s^2]
};
// Körper:
struct Koerper {
float masse; // [kg]
Vektor position;
Vektor geschwindigkeit;
};
Vektor addVektor(const Vektor &vec1, const Vektor &vec2);
Vektor mulVektor(const Vektor &vec, const float &skalar);
Koerper bewegeKoerper(const Koerper &korp, const Vektor &gesamtkraft,const float &dt);
void ausgabeKoerper(const Koerper &korp);
void ausgabeVektor(const Vektor &vec);
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+36 -1
View File
@@ -4,4 +4,39 @@
#include "flugkurve03.h"
using namespace std;
//to be implemented
void Vektor::mul(const float &skalar){
this->x *= skalar;
this->y *= skalar;
}
void Vektor::add(const Vektor &vec2) {
this->x += vec2.x;
this->y += vec2.y;
}
void Koerper::bewegen(const Vektor &beschleunigung,const float &dt) {
// Ermittlung der neuen Geschwindigkeit
this->geschwindigkeit.x += dt * beschleunigung.x;
this->geschwindigkeit.y += dt * beschleunigung.y;
// Ermittlung der neuen Position
this->position.x += dt * this->geschwindigkeit.x ;
this->position.y += dt * this->geschwindigkeit.y ;
}
float Koerper::liefereMasse(){
return this->masse;
}
Vektor Koerper::lieferePosition(){
return this->position;
}
Vektor Koerper::liefereGeschwindigkeit(){
return this->geschwindigkeit;
}
string Koerper::text(){
string outputX = to_string(this->position.x);
string outputY = to_string(this->position.y);
stringstream ganzeOut;
ganzeOut << "X= " << outputX << " Y= " << outputY;
return ganzeOut.str();
}
+33 -1
View File
@@ -1,4 +1,36 @@
#include <string>
using namespace std;
// to be defined
#pragma once
// Parametrierung der auf den Körper wirkende Kräfte:
class Vektor {
public:
float x; // [m/s^2]
float y; // [m/s^2]
Vektor() = default;
Vektor(float x, float y) {
this->x = x;
this->y = y;
}
void add(const Vektor &vec2);
void ausgabeVektor(const Vektor &vec);
void mul(const float &skalar);
};
// Körper:
class Koerper {
public:
float masse; // [kg]
Vektor position;
Vektor geschwindigkeit;
Koerper(float masse, Vektor position, Vektor geschwindigkeit) {
this->masse = masse;
this->position = position;
this->geschwindigkeit = geschwindigkeit;
};
float liefereMasse();
void bewegen(const Vektor &gesamtkraft, const float &dt);
Vektor lieferePosition();
Vektor liefereGeschwindigkeit();
string text();
};
Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

+15
View File
@@ -0,0 +1,15 @@
# Klassen:
- Verkehrsmittel
- Posistion (int x, int y)
- bewegen(neue Posistion)
- text()
- Luftfahrzeuge
- max. Flughöhe
- text()
- Radfahrzeuge
- Anzahl Räder
- text()
- Pkw
- Anzahl Türen
- text()
+11
View File
@@ -0,0 +1,11 @@
#pragma once
#include "Verkehrsmittel.h"
class Luftfahrzeug : public Verkehrsmittel{
private:
int maxFlughöhe;
public:
Luftfahrzeug (int maxFlughöhe){
this->maxFlughöhe = maxFlughöhe;
};
std::string text();
};
+12
View File
@@ -0,0 +1,12 @@
#pragma once
#include "Radfahrzeug.h"
#include "Verkehrsmittel.h"
class PKW : public Radfahrzeug {
private:
int anzahlTüren;
public:
PKW(int raeder, int türen) : Radfahrzeug(raeder) { anzahlTüren = türen; }
std::string text();
};
+12
View File
@@ -0,0 +1,12 @@
#pragma once
#include "Verkehrsmittel.h"
class Radfahrzeug : public Verkehrsmittel {
private:
int anzahlRäder;
public:
Radfahrzeug(int räder) { this->anzahlRäder = räder; }
std::string text();
int getRäder();
};
+13
View File
@@ -0,0 +1,13 @@
#pragma once
#include <string>
class Verkehrsmittel{
private:
int posX = 0;
int posY = 0;
public:
void bewege(int x, int y);
virtual std::string text();
int getX();
int getY();
};
BIN
View File
Binary file not shown.
+2 -1
View File
@@ -1,9 +1,10 @@
#include <cassert>
#include <iostream>
#include "Verkehrsmittel.h"
#include "Luftfahrzeug.h"
#include "Radfahrzeug.h"
#include "PKW.h"
using namespace std;
int main()
{
//Verkehrsmittel
+60
View File
@@ -0,0 +1,60 @@
#include "Luftfahrzeug.h"
#include "PKW.h"
#include "Radfahrzeug.h"
#include "Verkehrsmittel.h"
#include <sstream>
#include <string>
// Verkehrsmittel - Position x: 0; Position y: 0
int Verkehrsmittel::getX() { return posX; }
int Verkehrsmittel::getY() { return posY; }
int Radfahrzeug::getRäder() { return anzahlRäder; }
void Verkehrsmittel::bewege(int x, int y) {
this->posX = x;
this->posY = y;
}
std::string Verkehrsmittel::text() {
std::string Xstring = std::to_string(getX());
std::string Ystring = std::to_string(getY());
std::string Fahrzeug = "Verkehrsmittel";
std::stringstream output;
output << Fahrzeug << " - " << "Position x: " << Xstring
<< "; Position y: " << Ystring;
return output.str();
}
std::string Luftfahrzeug::text() {
std::string Xstring = std::to_string(getX());
std::string Ystring = std::to_string(getY());
std::string FlughöheString = std::to_string(maxFlughöhe);
std::string Fahrzeug = "Luftfahrzeug";
std::stringstream output;
output << Fahrzeug << " - " << "Position x: " << Xstring
<< "; Position y: " << Ystring << "; max. Höhe: " << FlughöheString;
return output.str();
}
std::string Radfahrzeug::text() {
std::string Xstring = std::to_string(getX());
std::string Ystring = std::to_string(getY());
std::string RäderString = std::to_string(anzahlRäder);
std::string Fahrzeug = "Radfahrzeug";
std::stringstream output;
output << Fahrzeug << " - " << "Position x: " << Xstring
<< "; Position y: " << Ystring << "; Anzahl Räder: " << RäderString;
return output.str();
}
std::string PKW::text() {
std::string Xstring = std::to_string(getX());
std::string Ystring = std::to_string(getY());
std::string Räderstring = std::to_string(getRäder());
std::string TürenString = std::to_string(anzahlTüren);
std::string Fahrzeug = "PKW";
std::stringstream output;
output << Fahrzeug << " - " << "Position x: " << Xstring
<< "; Position y: " << Ystring << "; Anzahl Räder: " << Räderstring
<< "; Anzahl Türen: " << TürenString;
return output.str();
}
BIN
View File
Binary file not shown.