some more

This commit is contained in:
rattatwinko
2025-04-29 20:53:38 +02:00
parent b489370357
commit 79670e7723
9 changed files with 114 additions and 0 deletions

Binary file not shown.

View File

@@ -0,0 +1,23 @@
#include <iostream>
/*
Here we have a Class which has a Function that is declared outside of the Class itself ;
We just reference the Function inside the class and later outside create a Function with this structure:
class::function()
*/
using namespace std;
class outside {
public:
void coolFunc();
};
void outside::coolFunc() {
cout << "I am a cool Outside Function\n";
};
int main() {
outside classobj;
classobj.coolFunc(); // No cout needed here for some reason ; idk why
}

19
OOP/class_methodes.cpp Normal file
View File

@@ -0,0 +1,19 @@
#include <iostream>
/*
Within a Class you can define Functions (called Methodes) ; you can define these to all datatypes you want but just be careful to not segfault
*/
using namespace std;
class MethodConstruction {
public:
void myCoolFunction() {
cout << "I am a very Cool Function and I got called!\n";
}
};
int main() {
MethodConstruction classobj;
classobj.myCoolFunction();
return 0;
}

23
OOP/simple.cpp Normal file
View File

@@ -0,0 +1,23 @@
#include <iostream>
using namespace std;
/* So basically a class is a template for data you can use anywhere ; so here you can def myVar to a int and a string to mystring and later output
that into a Object of that class (marked later in program)
*/
class MyClass {
public:
int myVar;
string myString;
};
int main() {
MyClass classobj1;
classobj1.myString = "You*re gay";
classobj1.myVar = 25565;
cout << classobj1.myString << "\n" << classobj1.myVar;
}

BIN
a.out

Binary file not shown.

6
arrays/py/sizeof_loop.py Normal file
View File

@@ -0,0 +1,6 @@
# dynamarray (c++topy)
numbers = [1,1,2,2,34,45,5,6,7,2,3,34]
for i in range(0, len(numbers)):
print(numbers[i])

View File

@@ -1,3 +1,9 @@
/*
We use the sizeof Opperator here to determine the size of the Array "numbers" {in this case 10} ;
After that we print "i" Element in "numbers"
*/
#include <iostream>
using namespace std;

BIN
switch/a.out Executable file

Binary file not shown.

37
switch/switchcase.cpp Normal file
View File

@@ -0,0 +1,37 @@
#include <iostream>
using namespace std;
int main() {
int day;
cout << "Tag in Nummer: \n";
cin >> day;
switch (day)
{
case 1:
cout << "Montag";
break;
case 2:
cout << "Dienstag";
break;
case 3:
cout << "Mittwoch";
break;
case 4:
cout << "Donnerstag";
break;
case 5:
cout << "Freitag";
break;
case 6:
cout << "Samstag";
break;
case 7:
cout << "Sonntag";
break;
default:
cout << "Nummer von 1 bis 7!";
break;
}
}