diff --git a/exercises/sum.cpp b/exercises/sum.cpp index 0dcca937..a0f809f8 100644 --- a/exercises/sum.cpp +++ b/exercises/sum.cpp @@ -6,3 +6,29 @@ Insert the second number: 2 Sum: 3 */ +#include +using namespace std; + +#define EXIT_SUCCESS 0 +#define EXIT_FAILURE 1 + +void getNumInput(int* num); +template void printSum(const T& n1, const T& n2); + +void getNumInput(int* num){ + cout << "Insert the first number: " << endl; + cin >> num[0]; + cout << "Insert the second number: " << endl; + cin >> num[1]; +} + +template void printSum(const T& n1, const T& n2){ + cout << "Sum: " << n1 + n2 << endl; +} + +int main(){ + int number[2]; + getNumInput(number); + printSum( number[0] , number[1] ); + return EXIT_SUCCESS; +} \ No newline at end of file