Error expected unqualified-id before else

Hi, Im in need of some help with some errors showing expected unqualified-id before 'else' and expected , or ; before else on lines 56. Trying to set an if else within a void function. Quite a newbie here. any tips or help would be greatthanks

void computer_coins(int coin_value, int& num, int& amount_left, int& quarters)
{

if (coin_value >= 0 || coin_value < 100)

quarters = (coin_value/25);
num = (coin_value - (quarters * 25)) / 10;
amount_left = coin_value - (quarters * 25+ num * 10);
}
else
cout << "incorrect value, would you like to try again?" << endl;
return 0;
You forgot the opening brace of your if statement. Also, a function that returns void cannot return 0.
thanks for the reply, but I dont know where your talking about, tried different spots with no luck.
1
2
3
4
5
6
if (coin_value >= 0 || coin_value < 100)
{ //here
quarters = (coin_value/25);
num = (coin_value - (quarters * 25)) / 10;
amount_left = coin_value - (quarters * 25+ num * 10);
}
Topic archived. No new replies allowed.