Hi there! Can you tell me what is "expected unqualified-id before '{' token" means?
I am writing a code that looks like this when it is done
Please enter two integer values separated by whitespace: 5 2
Here are the results:
5 plus 2 equals 7
5 minus 2 equals 3
5 multiplied by 2 equals 10
5 divided by 2 equals 2 with a remainder of 1
But with the second operand having a value of zero, we should see the following:
Please enter two integer values separated by whitespace: 5 0
Here are the results:
5 plus 0 equals 5
5 minus 0 equals 5
5 multiplied by 0 equals 0
Division by zero is undefined...
Can anybody take a look at my code and suggest how can I make it better?
#include <iostream>
using namespace std;
void CalcIntResults( int para1, int para2, int& refsum, int& refdifference, int& refproduct, int& refquotient, int& refremainder);
int main()
{
int sum = 1;
int difference = 1;
int product = 1;
int quotient = 1;
int remainder = 1;
int int1;
int int2;
cout << " Please enter two integer values separated by whitespace ";
cin >> int1 >> int2;
cout << " Here are the results: " << endl;
if ( int2 != 0)
{
CalcIntResults( int1, int2, sum, difference, product, quotient, remainder);
cout << int1 << "plus" << int2 << "equals" << sum << endl;
cout << int1 << "minus" << int2 << "equals" << difference << endl;
cout << int1 << "multiplied by" << int2 << "equals" << product << endl;
cout << int1 << "divided by" << int2 << "equals" << quotient << "with a remainder of" << remainder << endl;
}
else
{
CalcIntResults( int1, int2, sum, difference, product, quotient, remainder );
cout << int1 << "plus" << int2 << "equals" << sum << endl;
cout << int1 << "minus" << int2 << "equals" << difference << endl;
cout << int1 << "multiplied by" << int2 << "equals" << product << endl;
cout << "Dividing by zero is undefined" << endl;
}
return 0;
}
void CalcIntResults( int para1, int para2, int& refsum, int& refdifference, int& refproduct, int& refquotient, int& refremainder);
{