+ 2
Can someone please show me a conplete code of using functions. I am having a hard time doing them.
Functions
2 ответов
+ 2
code of a calculator using functions http://www.sololearn.com/app/cplusplus/playground/cd6qB7m8a18a/
+ 2
#include <iostream>
using namespace std;
// Function prototype (declaration)
int add(int, int);
int main()
{
int num1, num2, sum;
cout<<"Enters two numbers to add: ";
cin >> num1 >> num2;
// Function call
sum = add(num1, num2);
cout << "Sum = " << sum; return 0;
} // Function definition
int add(int a, int b)
{
int add;
add = a + b; // Return statement return add;
}