vault backup: 2026-04-16 08:46:37
This commit is contained in:
@@ -36,6 +36,14 @@ void upgrade(*Pokemon p, int gainedExp) {
|
|||||||
p->level += 1;
|
p->level += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
Pokemon fukano = {3600, 1, 400, 400, 20, 1200};
|
||||||
|
printf("Exp of fukano: %d", fukano);
|
||||||
|
upgrade(&fukano, 400);
|
||||||
|
printf("Exp of fukano: %d", fukano);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
In C++ we use classes:
|
In C++ we use classes:
|
||||||
@@ -57,4 +65,11 @@ public: // visibility modifier
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
Pokemon fukano = {3600, 1, 400, 400, 20, 1200};
|
||||||
|
cout << "Exp of fukano: " << fukano.exp << endl;
|
||||||
|
fukano.upgrade(400);
|
||||||
|
cout << "Exp of fukano: " << fukano.exp << endl;
|
||||||
|
}
|
||||||
```
|
```
|
||||||
Reference in New Issue
Block a user