Question #38297

write a function prototype (in C++) for a function which accepts two integers as parameters and returns their difference.

Expert's answer

#include <iostream>

using namespace std;

int diff(int, int); // prototype

int main()
{
cout << diff(5, 2);
cin.get(); cin.get();
return 0;
}

int diff(int a, int b) // function
{
return a - b;
}
LATEST TUTORIALS
APPROVED BY CLIENTS