vault backup: 2026-04-16 08:33:48
This commit is contained in:
21
.obsidian/workspace.json
vendored
21
.obsidian/workspace.json
vendored
@@ -22,7 +22,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "e179fd2c20f4067e",
|
||||
"id": "f2cbb43fcaaa6aec",
|
||||
"type": "leaf",
|
||||
"state": {
|
||||
"type": "markdown",
|
||||
@@ -34,20 +34,6 @@
|
||||
"icon": "lucide-file",
|
||||
"title": "29605321 - OOP 4_16"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "1e58a188bb5d367b",
|
||||
"type": "leaf",
|
||||
"state": {
|
||||
"type": "markdown",
|
||||
"state": {
|
||||
"file": "10 Courses/02 - SoSe 2026/AT/29593952 - Regular Languages.md",
|
||||
"mode": "source",
|
||||
"source": false
|
||||
},
|
||||
"icon": "lucide-file",
|
||||
"title": "29593952 - Regular Languages"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -212,8 +198,10 @@
|
||||
},
|
||||
"active": "7a0e7b37bd89861d",
|
||||
"lastOpenFiles": [
|
||||
"00 Inbox/29595454 - Komplexe Zahlen und Eigenwertaufgaben.md",
|
||||
"10 Courses/02 - SoSe 2026/AT/29593852 - Strings.md",
|
||||
"10 Courses/02 - SoSe 2026/AT/29593952 - Regular Languages.md",
|
||||
"00 Inbox/29605321 - OOP 4_16.md",
|
||||
"00 Inbox/29595454 - Komplexe Zahlen und Eigenwertaufgaben.md",
|
||||
"OOP - Apr",
|
||||
"10 Courses/02 - SoSe 2026/Mathe II/29595454 - Mathematik II.md",
|
||||
"20 Atlas/AT - Map of Content.md",
|
||||
@@ -227,7 +215,6 @@
|
||||
"10 Courses/02 - SoSe 2026/Mathe II/29595454 - Mathematik II.md",
|
||||
"10 Courses/02 - SoSe 2026/AT/29593975 - Regular Expressions.md",
|
||||
"10 Courses/02 - SoSe 2026/AT/29593958 - Kleene star of languages.md",
|
||||
"10 Courses/02 - SoSe 2026/AT/29593952 - Regular Languages.md",
|
||||
"10 Courses/02 - SoSe 2026/AT/29593940 - Formal Languages.md",
|
||||
"10 Courses/02 - SoSe 2026/AT/29593935 - Kleene Star & Kleene Plus.md",
|
||||
"10 Courses/02 - SoSe 2026/AT/29593929 - Alphabets.md",
|
||||
|
||||
@@ -22,15 +22,39 @@ C approach of defining a Pokemon:
|
||||
```C
|
||||
typedef struct {
|
||||
int exp;
|
||||
int level;
|
||||
int attack;
|
||||
unsigned int hp;
|
||||
char name[];
|
||||
int defense;
|
||||
int speed;
|
||||
int hp;
|
||||
} Pokemon;
|
||||
```
|
||||
|
||||
|
||||
```C++
|
||||
class Pokemon() {
|
||||
|
||||
void upgrade(*Pokemon p, int gainedExp) {
|
||||
p->exp += gainedExp;
|
||||
if (p->exp >= 4000) {
|
||||
p->exp -= 4000;
|
||||
p->level += 1;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
In C++ we use classes:
|
||||
```C++
|
||||
class Pokemon {
|
||||
public: // visibility modifier
|
||||
int exp;
|
||||
int level;
|
||||
int attack;
|
||||
int defense;
|
||||
int speed;
|
||||
int hp;
|
||||
|
||||
void upgrade(int gainedExp) {
|
||||
exp += gainedExp;
|
||||
if (exp >= 4000) {
|
||||
exp -= 4000;
|
||||
level += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user