void breakThree(int &num, int &a, int &b, int &c, bool &morethanthree = false);
Since 'morethanthree' is being passed by reference (that's what the & symbol means)... you can't give it a default value of 'false', since you cannot have a non-const reference to a literal value.
The assignment says to
RETURN true or false depending on whether or not it was successful. Returning does not mean "pass as parameter". Returning means returning:
1 2 3 4
|
int example()
{
return 5;
}
|
In this example function... it returns an int (that's what the type before the 'example' is -- it's the return type). And when it has a return statement... it has a value to return (here, it's returning 5).
Your current 'breakThree' function returns void (nothing). This is not correct. You want it to return a bool. return true if the function was successful, and return false if it wasn't.
1 2
|
//line 15
breakThree(x, y, z)
|
1) You're missing a semicolon
2) breakThree (assuming you get rid of the 'morethanthree' parameter) takes
FOUR parameters. You are only giving it 3. You need to give it 4.
1 for the number to separate
and 3 more for the separated digits.
Note that since the 3 separated digits are the only ones that are output... the 1st parameter (num) does not need to be passed by reference (you don't need the & symbol).
1 2 3 4
|
void breakThree(int &num, int &a, int &b, int &c, bool &morethanthree)
{
cout << "enter a three digit integer" << endl;
cin >> num;
|
breakThree should
not ask the user for anything. The number to separate is passed in as a parameter. Just work with that number.
main should be the one asking the user for the input. Once it gets that input, it should pass it to breakThree as a parameter.