add functions

This commit is contained in:
Kishan Takoordyal 2020-11-13 11:37:59 +04:00
parent df3b9fa2c6
commit 5b40a2a16c
3 changed files with 18 additions and 0 deletions

BIN
functions Executable file

Binary file not shown.

18
functions.cpp Normal file
View 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

Binary file not shown.