I cannot get the last function to work. I need to use pass by refrence to calcuate the quotient and modulus in one funtion.
output
21 + 10 = 31
21 - 10 = 11
21 * 10 = 210
21 / 10 = 2 modulus 1
#include <iostream>
#include <iomanip>
using namespace std;
// Prorotype Declarations
int add (int a, int b);
int subt (int a, int b);
int prod (int a, int b);
void division(int& a, int& b);
int main()
{
// User input
cout << "Please enter 2 integer numbers: ";
// Read numbers into a and b
int a;
int b;
cin >> a >> b;
int sum = add (a, b);
int diff = subt (a, b);
int product = prod(a, b);
// Displays output to screen
cout << setw(4) << a <<
" + " << setw(2) << b <<
" = " << setw(4) << sum << endl;
cout << setw(4) << a <<
" - " << setw(2) << b <<
" = " << setw(4) << diff << endl;
cout << setw(4) << a <<
" * " << setw(2) << b <<
" = " << setw(4) << product << endl;
cout << "\n thanks for using my caculator.";
cout << endl;
return 0;
}
// Function adds the numbers
int add (int a, int b)
{
return (a + b );
}
// Function subtracts the numbers
int subt (int a, int b)
{
return (a - b);
}
// Function multiplies the numbers
int prod (int a, int b)
{
return ( a * b);
}
// Function divides numbers
void division(int& a, int& b)
{
}
