Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"files.associations": {
"array": "cpp",
"atomic": "cpp",
"bit": "cpp",
"bitset": "cpp",
"cctype": "cpp",
"chrono": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"compare": "cpp",
"concepts": "cpp",
"condition_variable": "cpp",
"csignal": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"deque": "cpp",
"list": "cpp",
"map": "cpp",
"set": "cpp",
"string": "cpp",
"unordered_map": "cpp",
"vector": "cpp",
"exception": "cpp",
"algorithm": "cpp",
"functional": "cpp",
"iterator": "cpp",
"memory": "cpp",
"memory_resource": "cpp",
"numeric": "cpp",
"optional": "cpp",
"random": "cpp",
"ratio": "cpp",
"regex": "cpp",
"string_view": "cpp",
"system_error": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"utility": "cpp",
"fstream": "cpp",
"future": "cpp",
"initializer_list": "cpp",
"iomanip": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"limits": "cpp",
"mutex": "cpp",
"new": "cpp",
"numbers": "cpp",
"ostream": "cpp",
"semaphore": "cpp",
"sstream": "cpp",
"stdexcept": "cpp",
"stop_token": "cpp",
"streambuf": "cpp",
"thread": "cpp",
"typeinfo": "cpp",
"variant": "cpp"
}
}
28 changes: 28 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: g++ Aktive Datei kompilieren",
"command": "/usr/bin/g++",
"args": [
"-fdiagnostics-color=always",
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Vom Debugger generierte Aufgabe."
}
],
"version": "2.0.0"
}
1 change: 1 addition & 0 deletions src/lecture/2025_04_11/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
add_executable(vectors2 vectors2.cpp)
8 changes: 8 additions & 0 deletions src/lecture/2025_04_11/find_lists/find_lists.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include <iostream>
#include <vector>

int main() {std::cout << "Hallo Welt"<< std::endl;}

int findelement(std::vector<int> list, int el){
auto iter = std
}
Binary file added src/lecture/2025_04_11/vectors2
Binary file not shown.
64 changes: 64 additions & 0 deletions src/lecture/2025_04_11/vectors2.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#include <iostream>
#include <vector>
#include <algorithm>
#include "vectors2.h"



int main() { list_iteration(); list_find();}

void list_find(){
std::vector<int> v2{10,17,55,23,42,107,38};
std::cout << "List Find startet hier:" << std::endl;
// Herausfinden, an welcher Stelle die 55 steht.
int result = 0;
for (int i = 0; i<v2.size();i++){
if (v2[i] == 55) {
result = i;
break;
}
}
std::cout << result << std::endl;

// Bessere Methode
auto pos_55 = std::find(v2.begin(), v2.end(),55);
if (pos_55 != v2.end()){
std::cout << pos_55 - v2.begin()<< std::endl; //Stelle ausgeben.
std::cout << *pos_55 << std::endl;// Durch den Iterator wieder auf den Wert zugreifen.
}else{
std::cout << "Wert nicht gefunden!" << std::endl;
}
}

void list_iteration(){
std::vector<int> v1;

// Elemente am Ende einfügen.
v1.push_back(42);
v1.push_back(23);
v1.push_back(103);
v1.push_back(55);

// Zähler-Schleife, die über den Vector läuft
for (int i = 0; i<v1.size();i++){
std::cout << v1[i] <<" ";
}
std::cout << std::endl;


//Elemente am Anfang einfügen.
v1.insert(v1.begin(), 255);

//Elemente an Stelle 2 einfügen.
v1.insert(v1.begin()+2,700);

// Range-Schleife, die über der Vector läuft.
for (int el:v1){
std::cout << el <<" ";
}
std::cout << std::endl;
std::cout << v1.size() << std::endl;
std::cout << "Das war die Iteration funktion" << std::endl;
std::cout << std::endl;

}
10 changes: 10 additions & 0 deletions src/lecture/2025_04_11/vectors2.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#ifndef VECTORS_2
#define VECTORS_2

// Beispiele für den Aufbau und das Iterieren über Vektoren.
void list_iteration();

// Beispiele für die Lineare Suche in Listen.
void list_find();

#endif
1 change: 1 addition & 0 deletions src/lecture/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
add_subdirectory(2025_04_04)
add_subdirectory(2025_04_11)