add functions
This commit is contained in:
18
functions.cpp
Normal file
18
functions.cpp
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
int takeDamage(int attack, int defense) {
|
||||||
|
int damage = attack - defense;
|
||||||
|
|
||||||
|
if (damage < 0) {
|
||||||
|
damage = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return damage;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
int damage = takeDamage(9, 5);
|
||||||
|
cout << damage;
|
||||||
|
}
|
||||||
BIN
hello_world
Executable file
BIN
hello_world
Executable file
Binary file not shown.
Reference in New Issue
Block a user