add functions
This commit is contained in:
parent
df3b9fa2c6
commit
5b40a2a16c
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.
Loading…
x
Reference in New Issue
Block a user