diff --git a/TE2/.settings/language.settings.xml b/TE2/.settings/language.settings.xml index 859cc07..1b23e35 100644 --- a/TE2/.settings/language.settings.xml +++ b/TE2/.settings/language.settings.xml @@ -5,7 +5,7 @@ - + @@ -16,7 +16,7 @@ - + diff --git a/TE2/Aliasing/.settings/language.settings.xml b/TE2/Aliasing/.settings/language.settings.xml index 28429f6..a730518 100644 --- a/TE2/Aliasing/.settings/language.settings.xml +++ b/TE2/Aliasing/.settings/language.settings.xml @@ -5,7 +5,7 @@ - + @@ -16,7 +16,7 @@ - + diff --git a/TE2/Array/.cproject b/TE2/Array/.cproject new file mode 100644 index 0000000..a0c93b3 --- /dev/null +++ b/TE2/Array/.cproject @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/TE2/Array/.gitignore b/TE2/Array/.gitignore new file mode 100644 index 0000000..3df573f --- /dev/null +++ b/TE2/Array/.gitignore @@ -0,0 +1 @@ +/Debug/ diff --git a/TE2/Array/.project b/TE2/Array/.project new file mode 100644 index 0000000..2b68ec6 --- /dev/null +++ b/TE2/Array/.project @@ -0,0 +1,27 @@ + + + Array + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + clean,full,incremental, + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + diff --git a/TE2/Array/.settings/language.settings.xml b/TE2/Array/.settings/language.settings.xml new file mode 100644 index 0000000..69f3bf8 --- /dev/null +++ b/TE2/Array/.settings/language.settings.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/TE2/Array/.settings/org.eclipse.cdt.managedbuilder.core.prefs b/TE2/Array/.settings/org.eclipse.cdt.managedbuilder.core.prefs new file mode 100644 index 0000000..02d9c3a --- /dev/null +++ b/TE2/Array/.settings/org.eclipse.cdt.managedbuilder.core.prefs @@ -0,0 +1,13 @@ +eclipse.preferences.version=1 +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.388389967/CPATH/delimiter=; +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.388389967/CPATH/operation=remove +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.388389967/CPLUS_INCLUDE_PATH/delimiter=; +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.388389967/CPLUS_INCLUDE_PATH/operation=remove +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.388389967/C_INCLUDE_PATH/delimiter=; +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.388389967/C_INCLUDE_PATH/operation=remove +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.388389967/append=true +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.388389967/appendContributed=true +environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.388389967/LIBRARY_PATH/delimiter=; +environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.388389967/LIBRARY_PATH/operation=remove +environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.388389967/append=true +environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.388389967/appendContributed=true diff --git a/TE2/Array/.settings/org.eclipse.core.resources.prefs b/TE2/Array/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/TE2/Array/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/TE2/Array/Array.cpp b/TE2/Array/Array.cpp new file mode 100644 index 0000000..f5ead33 --- /dev/null +++ b/TE2/Array/Array.cpp @@ -0,0 +1,46 @@ +#include +using namespace std; +/* + * - keine Notwendigkeit für das Schlüsselwort new bei der Initialisierung eines Arrays, + * - (sizeof) Methode: gibt die Größe des gesamten Arrays in Bytes, + * jedes index hat 4Byte + */ + +int main(){ + + // keine Notwendigkeit für das Schlüsselwort "new" + int arr[5] = {1,2,4,3,4}; + + // das geht nicht + /*int arr[5]; + * arr = {1,2,3,4,5} //Fehler + * + */ + + // die länge des Arrays + cout<< sizeof(arr) / sizeof(arr[0])<> arr[i] ; + //size_t stellt sicher, dass der Index i immer nicht-negativ ist, + //da Array-Indizes nie negativ sein können. + } + + // Array mit forschleife ausgeben: + for (int i = 0; i < 5; i++) { + cout << arr[i] << endl; + } + + // char Array: + // Deklaration und Initialisierung eines Zeichen-Arrays + // keine Notwendigkeit Forloops + //'\0' zeigt das Ende der Zeichenkette an und ist in C++ bei Zeichen-Arrays erforderlich, um sie als gültige Strings zu behandeln. + char str[] = { 'H', 'e', 'l', 'l', 'o', '\0' }; // Manuelle Initialisierung mit '\0' + cout << "Zeichen-Array: " << str < - + @@ -16,7 +16,7 @@ - + diff --git a/TE2/Casting/.settings/language.settings.xml b/TE2/Casting/.settings/language.settings.xml index 2506803..0973514 100644 --- a/TE2/Casting/.settings/language.settings.xml +++ b/TE2/Casting/.settings/language.settings.xml @@ -5,7 +5,7 @@ - + @@ -16,7 +16,7 @@ - + diff --git a/TE2/ConstantVariable/.settings/language.settings.xml b/TE2/ConstantVariable/.settings/language.settings.xml index 869d502..cb5fe24 100644 --- a/TE2/ConstantVariable/.settings/language.settings.xml +++ b/TE2/ConstantVariable/.settings/language.settings.xml @@ -5,7 +5,7 @@ - + @@ -16,7 +16,7 @@ - + diff --git a/TE2/ConstantVariable/ConstantVariable.cpp b/TE2/ConstantVariable/ConstantVariable.cpp index cd953cb..eb02b6c 100644 --- a/TE2/ConstantVariable/ConstantVariable.cpp +++ b/TE2/ConstantVariable/ConstantVariable.cpp @@ -7,18 +7,17 @@ using namespace std; */ void print(const int &x2) { // x ist eine konstante Referenz - // x = 20; // Fehler: Du kannst den Wert von x nicht ändern - cout << "Wert von x2: " << x2 < - + @@ -16,7 +16,7 @@ - + diff --git a/TE2/Eingabe/.settings/language.settings.xml b/TE2/Eingabe/.settings/language.settings.xml index e54318f..094fd8c 100644 --- a/TE2/Eingabe/.settings/language.settings.xml +++ b/TE2/Eingabe/.settings/language.settings.xml @@ -5,7 +5,7 @@ - + @@ -16,7 +16,7 @@ - + diff --git a/TE2/EscapeSequence/.settings/language.settings.xml b/TE2/EscapeSequence/.settings/language.settings.xml index 2173239..8855d74 100644 --- a/TE2/EscapeSequence/.settings/language.settings.xml +++ b/TE2/EscapeSequence/.settings/language.settings.xml @@ -5,7 +5,7 @@ - + @@ -16,7 +16,7 @@ - + diff --git a/TE2/LocalvsGlobal/.settings/language.settings.xml b/TE2/LocalvsGlobal/.settings/language.settings.xml index c394df3..0d620cc 100644 --- a/TE2/LocalvsGlobal/.settings/language.settings.xml +++ b/TE2/LocalvsGlobal/.settings/language.settings.xml @@ -5,7 +5,7 @@ - + @@ -16,7 +16,7 @@ - + diff --git a/TE2/Methoden/.settings/language.settings.xml b/TE2/Methoden/.settings/language.settings.xml index f1bc4dc..4952e8a 100644 --- a/TE2/Methoden/.settings/language.settings.xml +++ b/TE2/Methoden/.settings/language.settings.xml @@ -5,7 +5,7 @@ - + @@ -16,7 +16,7 @@ - + diff --git a/TE2/Pointer/.cproject b/TE2/Pointer/.cproject new file mode 100644 index 0000000..efd8472 --- /dev/null +++ b/TE2/Pointer/.cproject @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/TE2/Pointer/.gitignore b/TE2/Pointer/.gitignore new file mode 100644 index 0000000..3df573f --- /dev/null +++ b/TE2/Pointer/.gitignore @@ -0,0 +1 @@ +/Debug/ diff --git a/TE2/Pointer/.project b/TE2/Pointer/.project new file mode 100644 index 0000000..ca47292 --- /dev/null +++ b/TE2/Pointer/.project @@ -0,0 +1,27 @@ + + + Pointer + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + clean,full,incremental, + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + diff --git a/TE2/Pointer/.settings/language.settings.xml b/TE2/Pointer/.settings/language.settings.xml new file mode 100644 index 0000000..efd769e --- /dev/null +++ b/TE2/Pointer/.settings/language.settings.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/TE2/Pointer/.settings/org.eclipse.cdt.managedbuilder.core.prefs b/TE2/Pointer/.settings/org.eclipse.cdt.managedbuilder.core.prefs new file mode 100644 index 0000000..e001f61 --- /dev/null +++ b/TE2/Pointer/.settings/org.eclipse.cdt.managedbuilder.core.prefs @@ -0,0 +1,13 @@ +eclipse.preferences.version=1 +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.2019503511/CPATH/delimiter=; +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.2019503511/CPATH/operation=remove +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.2019503511/CPLUS_INCLUDE_PATH/delimiter=; +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.2019503511/CPLUS_INCLUDE_PATH/operation=remove +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.2019503511/C_INCLUDE_PATH/delimiter=; +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.2019503511/C_INCLUDE_PATH/operation=remove +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.2019503511/append=true +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.2019503511/appendContributed=true +environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.2019503511/LIBRARY_PATH/delimiter=; +environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.2019503511/LIBRARY_PATH/operation=remove +environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.2019503511/append=true +environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.2019503511/appendContributed=true diff --git a/TE2/Pointer/.settings/org.eclipse.core.resources.prefs b/TE2/Pointer/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/TE2/Pointer/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/TE2/Pointer/Pointer.cpp b/TE2/Pointer/Pointer.cpp new file mode 100644 index 0000000..6580853 --- /dev/null +++ b/TE2/Pointer/Pointer.cpp @@ -0,0 +1,45 @@ +#include +using namespace std; + /* + * - Zeiger speichert die Speicheradresse einer anderen Variable + * - "*": ist die Zeiger (pointer), und zeigt nur auf Adressen im Ram + * - "&": ist die Adresse im Ram, auf die die Zeiger zeigt + * - void pointer: kann auf all datenTyps zeigen, aber soll erst gecastet werden + */ + +int main(){ + + //Zeiger auf zeiger: + int x = 5; + int *zei = &x; // Zeiger auf int + int **zei2 = &zei; // Zeiger auf Zeiger + + + + + int* ptr2 = nullptr; // ptr2 zeigt auf nichts (null) + + + + //int *ptr = 5; // falsch, weil Zeiger Speicheradresse erwartet + + int value = 5; + //int *zeiger = value;// auch falsch, weil Zeiger Speicheradresse erwartet + + //richtig, Zeiger zeigt auf adresse + int value2 = 5; + int *zeiger = &value2; + + cout<< "Zeiger Value ist "<< *zeiger + 1<(ptr); + cout<< "Zeiger Value mit casting ist "<< *cast< - + @@ -16,7 +16,7 @@ - + diff --git a/TE2/Struktur(struct)/.cproject b/TE2/Struktur(struct)/.cproject new file mode 100644 index 0000000..4c33996 --- /dev/null +++ b/TE2/Struktur(struct)/.cproject @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/TE2/Struktur(struct)/.gitignore b/TE2/Struktur(struct)/.gitignore new file mode 100644 index 0000000..3df573f --- /dev/null +++ b/TE2/Struktur(struct)/.gitignore @@ -0,0 +1 @@ +/Debug/ diff --git a/TE2/Struktur(struct)/.project b/TE2/Struktur(struct)/.project new file mode 100644 index 0000000..87e730d --- /dev/null +++ b/TE2/Struktur(struct)/.project @@ -0,0 +1,27 @@ + + + Struktur(struct) + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + clean,full,incremental, + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + diff --git a/TE2/Struktur(struct)/.settings/language.settings.xml b/TE2/Struktur(struct)/.settings/language.settings.xml new file mode 100644 index 0000000..6a1d9ca --- /dev/null +++ b/TE2/Struktur(struct)/.settings/language.settings.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/TE2/Struktur(struct)/.settings/org.eclipse.cdt.managedbuilder.core.prefs b/TE2/Struktur(struct)/.settings/org.eclipse.cdt.managedbuilder.core.prefs new file mode 100644 index 0000000..bbe1d60 --- /dev/null +++ b/TE2/Struktur(struct)/.settings/org.eclipse.cdt.managedbuilder.core.prefs @@ -0,0 +1,13 @@ +eclipse.preferences.version=1 +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1569572788/CPATH/delimiter=; +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1569572788/CPATH/operation=remove +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1569572788/CPLUS_INCLUDE_PATH/delimiter=; +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1569572788/CPLUS_INCLUDE_PATH/operation=remove +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1569572788/C_INCLUDE_PATH/delimiter=; +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1569572788/C_INCLUDE_PATH/operation=remove +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1569572788/append=true +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1569572788/appendContributed=true +environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.1569572788/LIBRARY_PATH/delimiter=; +environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.1569572788/LIBRARY_PATH/operation=remove +environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.1569572788/append=true +environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.1569572788/appendContributed=true diff --git a/TE2/Struktur(struct)/.settings/org.eclipse.core.resources.prefs b/TE2/Struktur(struct)/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/TE2/Struktur(struct)/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/TE2/Struktur(struct)/Struktur(struct).cpp b/TE2/Struktur(struct)/Struktur(struct).cpp new file mode 100644 index 0000000..7137261 --- /dev/null +++ b/TE2/Struktur(struct)/Struktur(struct).cpp @@ -0,0 +1,145 @@ +#include +using namespace std; +/* + * - ist eine benutzerdefinierte Datentyp-Deklaration, die beliebig viele Felder haben können + * - Zugriff auf Strukturmitglieder: erfolgt mit + * . dem Punkt-Operator (.), o + * . der bei Verwendung von Zeigern mit dem ->Operator + * + */ + + +// Definition einer Struktur "Person" +struct Person { + string name; + int alter; + float groesse; +}; + +// Kurzform für die Struktur "Person" warum? +// weil in C musst du beim Deklarieren einer Strukturvariable immer das Schlüsselwort struct verwenden. +// beispiel in c: struct Kurzform Kurzform; +typedef struct { + std::string name; + int alter; + float groesse; +} Kurzform; + +//Verschachtelte Strukturen + +struct Adresse { + string stadt; + string strasse; + int hausnummer; +}; + +struct Mensch { + string name; + int alter; + Adresse adresse; //Struktur an Mensch senden +}; + +// Definition einer Struktur "Person" mit (Zugriffsmodifikatoren ) +struct PersonMitZugriffsmodifikatoren { + // Öffentliche Mitglieder +public: + string name; + + // Private Mitglieder +private: + int alter; + float groesse; + +public: + // Öffentliche Methode, um auf private Mitglieder zuzugreifen + void setPersonData(int a, float g) { + alter = a; + groesse = g; + } + // Öffentliche Methode, um die private Mitglieder auszugeben + + void printPersonData() { + cout << "Name: " << name << endl; + cout << "Alter: " << alter << endl; + cout << "Größe: " << groesse << endl; + } +}; + +int main() { + + // Deklaration einer Struktur-Variable vom Typ Person + Person person1; + + + // oder Initialisierung einer Struktur bei der Deklaration + Person person2 = {"Bob", 25, 1.80}; + + person1.name = "Alice"; + person1.alter = 30; + person1.groesse = 1.75; + + // Ausgabe der Strukturmitglieder + cout << "Name: " << person1.name <name << endl; + cout << "Alter: " << personZeiger->alter << endl; + cout << "Größe: " << personZeiger->groesse << " Meter" < - + @@ -16,7 +16,7 @@ - + diff --git a/TE2/Zeichenkette(String)/.cproject b/TE2/Zeichenkette(String)/.cproject new file mode 100644 index 0000000..f824e89 --- /dev/null +++ b/TE2/Zeichenkette(String)/.cproject @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/TE2/Zeichenkette(String)/.gitignore b/TE2/Zeichenkette(String)/.gitignore new file mode 100644 index 0000000..3df573f --- /dev/null +++ b/TE2/Zeichenkette(String)/.gitignore @@ -0,0 +1 @@ +/Debug/ diff --git a/TE2/Zeichenkette(String)/.project b/TE2/Zeichenkette(String)/.project new file mode 100644 index 0000000..6a99d07 --- /dev/null +++ b/TE2/Zeichenkette(String)/.project @@ -0,0 +1,27 @@ + + + Zeichenkette(String) + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + clean,full,incremental, + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + diff --git a/TE2/Zeichenkette(String)/.settings/language.settings.xml b/TE2/Zeichenkette(String)/.settings/language.settings.xml new file mode 100644 index 0000000..9bd6b7d --- /dev/null +++ b/TE2/Zeichenkette(String)/.settings/language.settings.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/TE2/Zeichenkette(String)/.settings/org.eclipse.cdt.managedbuilder.core.prefs b/TE2/Zeichenkette(String)/.settings/org.eclipse.cdt.managedbuilder.core.prefs new file mode 100644 index 0000000..9e57431 --- /dev/null +++ b/TE2/Zeichenkette(String)/.settings/org.eclipse.cdt.managedbuilder.core.prefs @@ -0,0 +1,13 @@ +eclipse.preferences.version=1 +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.21713137/CPATH/delimiter=; +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.21713137/CPATH/operation=remove +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.21713137/CPLUS_INCLUDE_PATH/delimiter=; +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.21713137/CPLUS_INCLUDE_PATH/operation=remove +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.21713137/C_INCLUDE_PATH/delimiter=; +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.21713137/C_INCLUDE_PATH/operation=remove +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.21713137/append=true +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.21713137/appendContributed=true +environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.21713137/LIBRARY_PATH/delimiter=; +environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.21713137/LIBRARY_PATH/operation=remove +environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.21713137/append=true +environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.21713137/appendContributed=true diff --git a/TE2/Zeichenkette(String)/.settings/org.eclipse.core.resources.prefs b/TE2/Zeichenkette(String)/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/TE2/Zeichenkette(String)/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/TE2/Zeichenkette(String)/Zeichenkette(String).cpp b/TE2/Zeichenkette(String)/Zeichenkette(String).cpp new file mode 100644 index 0000000..5e70152 --- /dev/null +++ b/TE2/Zeichenkette(String)/Zeichenkette(String).cpp @@ -0,0 +1,22 @@ +#include +using namespace std; + +int main(){ + string str = "Hello, World!"; + + // Länge des Strings + cout << "Länge des Strings: " << str.length() << std::endl; + + // Konkatenation (Verkettung) von Strings + string str2 = str + " Wie geht's?"; + cout << "Verketteter String: " << str2 << std::endl; + + // Zugriff auf einzelne Zeichen + cout << "Erstes Zeichen: " << str[0] << std::endl; + + // Vergleich von Strings + if (str == "Hello, World!") + cout << "Die Strings sind gleich" << std::endl; + + return 0; +}