diff --git a/TE2/LocalvsGlobal/.cproject b/TE2/LocalvsGlobal/.cproject new file mode 100644 index 0000000..ff4177e --- /dev/null +++ b/TE2/LocalvsGlobal/.cproject @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/TE2/Variables vs Data type/.gitignore b/TE2/LocalvsGlobal/.gitignore similarity index 100% rename from TE2/Variables vs Data type/.gitignore rename to TE2/LocalvsGlobal/.gitignore diff --git a/TE2/LocalvsGlobal/.project b/TE2/LocalvsGlobal/.project new file mode 100644 index 0000000..175e44a --- /dev/null +++ b/TE2/LocalvsGlobal/.project @@ -0,0 +1,27 @@ + + + LocalvsGlobal + + + + + + 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/Variables vs Data type/.settings/language.settings.xml b/TE2/LocalvsGlobal/.settings/language.settings.xml similarity index 97% rename from TE2/Variables vs Data type/.settings/language.settings.xml rename to TE2/LocalvsGlobal/.settings/language.settings.xml index 5fa97fb..0d620cc 100644 --- a/TE2/Variables vs Data type/.settings/language.settings.xml +++ b/TE2/LocalvsGlobal/.settings/language.settings.xml @@ -1,6 +1,6 @@ - + @@ -11,7 +11,7 @@ - + diff --git a/TE2/Variables vs Data type/.settings/org.eclipse.cdt.managedbuilder.core.prefs b/TE2/LocalvsGlobal/.settings/org.eclipse.cdt.managedbuilder.core.prefs similarity index 56% rename from TE2/Variables vs Data type/.settings/org.eclipse.cdt.managedbuilder.core.prefs rename to TE2/LocalvsGlobal/.settings/org.eclipse.cdt.managedbuilder.core.prefs index ac5c889..2c7695c 100644 --- a/TE2/Variables vs Data type/.settings/org.eclipse.cdt.managedbuilder.core.prefs +++ b/TE2/LocalvsGlobal/.settings/org.eclipse.cdt.managedbuilder.core.prefs @@ -1,13 +1,13 @@ eclipse.preferences.version=1 -environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.587337262/CPATH/delimiter=; -environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.587337262/CPATH/operation=remove -environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.587337262/CPLUS_INCLUDE_PATH/delimiter=; -environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.587337262/CPLUS_INCLUDE_PATH/operation=remove -environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.587337262/C_INCLUDE_PATH/delimiter=; -environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.587337262/C_INCLUDE_PATH/operation=remove -environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.587337262/append=true -environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.587337262/appendContributed=true -environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.587337262/LIBRARY_PATH/delimiter=; -environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.587337262/LIBRARY_PATH/operation=remove -environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.587337262/append=true -environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.587337262/appendContributed=true +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.715749110/CPATH/delimiter=; +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.715749110/CPATH/operation=remove +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.715749110/CPLUS_INCLUDE_PATH/delimiter=; +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.715749110/CPLUS_INCLUDE_PATH/operation=remove +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.715749110/C_INCLUDE_PATH/delimiter=; +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.715749110/C_INCLUDE_PATH/operation=remove +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.715749110/append=true +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.715749110/appendContributed=true +environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.715749110/LIBRARY_PATH/delimiter=; +environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.715749110/LIBRARY_PATH/operation=remove +environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.715749110/append=true +environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.715749110/appendContributed=true diff --git a/TE2/Variables vs Data type/.settings/org.eclipse.core.resources.prefs b/TE2/LocalvsGlobal/.settings/org.eclipse.core.resources.prefs similarity index 100% rename from TE2/Variables vs Data type/.settings/org.eclipse.core.resources.prefs rename to TE2/LocalvsGlobal/.settings/org.eclipse.core.resources.prefs diff --git a/TE2/LocalvsGlobal/LocalvsGlobalVariablen.cpp b/TE2/LocalvsGlobal/LocalvsGlobalVariablen.cpp new file mode 100644 index 0000000..b0da323 --- /dev/null +++ b/TE2/LocalvsGlobal/LocalvsGlobalVariablen.cpp @@ -0,0 +1,23 @@ +#include +using namespace std; + + /* + * - Den Rest läuft wie in Java + */ + + //globale Variabel + int globalVar = 100; +int main() { + + // diese lokale Variable "überdeckt" die globale + int globalVar = 200; + + + // (::) dient als this in java + cout << globalVar < + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/TE2/Methoden/.gitignore b/TE2/Methoden/.gitignore new file mode 100644 index 0000000..3df573f --- /dev/null +++ b/TE2/Methoden/.gitignore @@ -0,0 +1 @@ +/Debug/ diff --git a/TE2/Methoden/.project b/TE2/Methoden/.project new file mode 100644 index 0000000..74b3993 --- /dev/null +++ b/TE2/Methoden/.project @@ -0,0 +1,27 @@ + + + Methoden + + + + + + 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/Methoden/.settings/language.settings.xml b/TE2/Methoden/.settings/language.settings.xml new file mode 100644 index 0000000..4952e8a --- /dev/null +++ b/TE2/Methoden/.settings/language.settings.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/TE2/Methoden/.settings/org.eclipse.cdt.managedbuilder.core.prefs b/TE2/Methoden/.settings/org.eclipse.cdt.managedbuilder.core.prefs new file mode 100644 index 0000000..f620f7c --- /dev/null +++ b/TE2/Methoden/.settings/org.eclipse.cdt.managedbuilder.core.prefs @@ -0,0 +1,13 @@ +eclipse.preferences.version=1 +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.883511050/CPATH/delimiter=; +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.883511050/CPATH/operation=remove +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.883511050/CPLUS_INCLUDE_PATH/delimiter=; +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.883511050/CPLUS_INCLUDE_PATH/operation=remove +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.883511050/C_INCLUDE_PATH/delimiter=; +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.883511050/C_INCLUDE_PATH/operation=remove +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.883511050/append=true +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.883511050/appendContributed=true +environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.883511050/LIBRARY_PATH/delimiter=; +environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.883511050/LIBRARY_PATH/operation=remove +environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.883511050/append=true +environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.883511050/appendContributed=true diff --git a/TE2/Methoden/.settings/org.eclipse.core.resources.prefs b/TE2/Methoden/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/TE2/Methoden/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/TE2/Methoden/Methoden.cpp b/TE2/Methoden/Methoden.cpp new file mode 100644 index 0000000..5e35873 --- /dev/null +++ b/TE2/Methoden/Methoden.cpp @@ -0,0 +1,32 @@ +#include +#include +using namespace std; + +// Funktion außerhalb der Klasse +int add(int a, int b) { + return a + b; +} + +// Methode mit Standardparameter +int add2(int a, int b = 10) { // b hat einen Standardwert von 10 + return a + b; +} + +//Variadische Funktionen +int sum(int count, ...) { + va_list args; + va_start(args, count); + int result = 0; + for (int i = 0; i < count; i++) { + result += va_arg(args, int); + } + va_end(args); + return result; +} + +int main() { + + cout << add2(3) << endl; + + return 0; +} diff --git a/TE2/Random/.cproject b/TE2/Random/.cproject new file mode 100644 index 0000000..effd77e --- /dev/null +++ b/TE2/Random/.cproject @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/TE2/Random/.gitignore b/TE2/Random/.gitignore new file mode 100644 index 0000000..3df573f --- /dev/null +++ b/TE2/Random/.gitignore @@ -0,0 +1 @@ +/Debug/ diff --git a/TE2/Random/.project b/TE2/Random/.project new file mode 100644 index 0000000..16e4ac4 --- /dev/null +++ b/TE2/Random/.project @@ -0,0 +1,27 @@ + + + Random + + + + + + 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/Random/.settings/language.settings.xml b/TE2/Random/.settings/language.settings.xml new file mode 100644 index 0000000..b125e12 --- /dev/null +++ b/TE2/Random/.settings/language.settings.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/TE2/Random/.settings/org.eclipse.cdt.managedbuilder.core.prefs b/TE2/Random/.settings/org.eclipse.cdt.managedbuilder.core.prefs new file mode 100644 index 0000000..022f826 --- /dev/null +++ b/TE2/Random/.settings/org.eclipse.cdt.managedbuilder.core.prefs @@ -0,0 +1,13 @@ +eclipse.preferences.version=1 +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1213004975/CPATH/delimiter=; +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1213004975/CPATH/operation=remove +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1213004975/CPLUS_INCLUDE_PATH/delimiter=; +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1213004975/CPLUS_INCLUDE_PATH/operation=remove +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1213004975/C_INCLUDE_PATH/delimiter=; +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1213004975/C_INCLUDE_PATH/operation=remove +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1213004975/append=true +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1213004975/appendContributed=true +environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.1213004975/LIBRARY_PATH/delimiter=; +environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.1213004975/LIBRARY_PATH/operation=remove +environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.1213004975/append=true +environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.1213004975/appendContributed=true diff --git a/TE2/Random/.settings/org.eclipse.core.resources.prefs b/TE2/Random/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/TE2/Random/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/TE2/Random/Random.cpp b/TE2/Random/Random.cpp new file mode 100644 index 0000000..3b31a88 --- /dev/null +++ b/TE2/Random/Random.cpp @@ -0,0 +1,18 @@ +#include +#include +using namespace std; + +int main(){ + + // Generiere eine Zufallszahl + int random = rand(); + + + + // Um die Zufallszahl in einem bestimmten Bereich zu erhalten: + int randomInRange = rand() % 100; // Zahl zwischen 0 und 99 + + + return 0; +} + diff --git a/TE2/Variables vs Data type/VariablesvsDataType.cpp b/TE2/Variables vs Data type/VariablesvsDataType.cpp index fe34bbc..1d6cfed 100644 --- a/TE2/Variables vs Data type/VariablesvsDataType.cpp +++ b/TE2/Variables vs Data type/VariablesvsDataType.cpp @@ -1,4 +1,3 @@ - #include using namespace std; diff --git a/TE2/Variables vs Data type/.cproject b/TE2/Verzweigungen/.cproject similarity index 58% rename from TE2/Variables vs Data type/.cproject rename to TE2/Verzweigungen/.cproject index 7e8be74..792d0f8 100644 --- a/TE2/Variables vs Data type/.cproject +++ b/TE2/Verzweigungen/.cproject @@ -1,8 +1,8 @@ - - + + @@ -12,29 +12,29 @@ - - - - - - - - - + + @@ -56,29 +56,29 @@ - - - - - - - - - + - + - + - + - + - \ No newline at end of file diff --git a/TE2/Verzweigungen/.gitignore b/TE2/Verzweigungen/.gitignore new file mode 100644 index 0000000..3df573f --- /dev/null +++ b/TE2/Verzweigungen/.gitignore @@ -0,0 +1 @@ +/Debug/ diff --git a/TE2/Verzweigungen/.project b/TE2/Verzweigungen/.project new file mode 100644 index 0000000..7fe4879 --- /dev/null +++ b/TE2/Verzweigungen/.project @@ -0,0 +1,27 @@ + + + Verzweigungen + + + + + + 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/Verzweigungen/.settings/language.settings.xml b/TE2/Verzweigungen/.settings/language.settings.xml new file mode 100644 index 0000000..aa6fbe5 --- /dev/null +++ b/TE2/Verzweigungen/.settings/language.settings.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/TE2/Verzweigungen/.settings/org.eclipse.cdt.managedbuilder.core.prefs b/TE2/Verzweigungen/.settings/org.eclipse.cdt.managedbuilder.core.prefs new file mode 100644 index 0000000..dea2e78 --- /dev/null +++ b/TE2/Verzweigungen/.settings/org.eclipse.cdt.managedbuilder.core.prefs @@ -0,0 +1,13 @@ +eclipse.preferences.version=1 +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1397240390/CPATH/delimiter=; +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1397240390/CPATH/operation=remove +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1397240390/CPLUS_INCLUDE_PATH/delimiter=; +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1397240390/CPLUS_INCLUDE_PATH/operation=remove +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1397240390/C_INCLUDE_PATH/delimiter=; +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1397240390/C_INCLUDE_PATH/operation=remove +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1397240390/append=true +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1397240390/appendContributed=true +environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.1397240390/LIBRARY_PATH/delimiter=; +environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.1397240390/LIBRARY_PATH/operation=remove +environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.1397240390/append=true +environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.1397240390/appendContributed=true diff --git a/TE2/Verzweigungen/.settings/org.eclipse.core.resources.prefs b/TE2/Verzweigungen/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/TE2/Verzweigungen/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/TE2/Verzweigungen/Verzweigungen.cpp b/TE2/Verzweigungen/Verzweigungen.cpp new file mode 100644 index 0000000..bb7a6f9 --- /dev/null +++ b/TE2/Verzweigungen/Verzweigungen.cpp @@ -0,0 +1,47 @@ +#include +using namespace std; +/* + * - C++ erlaubt es außerdem, Ganzzahlen in if-Statements zu verwenden. + * Jede Zahl != 0 wird als (true) betrachtet, während 0 als false gilt. + */ + + +int main() { + + int x = 1; + if (x) // wahr, da x ungleich 0 + cout << "x is non-zero" < 0) ? 1 : -1; // Wenn a > 0, result = 1, sonst -1 + + + /* + * switch (expression) { + * case constant1: + * Code für Fall 1 + * break; + * case constant2: + * Code für Fall 2 + * break; + * + * default: + * Code für den Standardfall + * + * Datentypen, die im switch verwendet werden können: + * - int, char, enum, und unsigned int. + * + */ + + return 0; + +}