Help with void functions

Write a program that tells what coins to give out for any amount of change from 1 cent to 99 cents.
For example, if the amount is 86 cents, the output would be something like the following:

86 cents can be given as 3 quarter(s) 1 dime(s) amd 1 penny(pennies).
Use coin denominations of 25 cents (quarters),
10 cents (dimes) and 1 cent (pennies).
Do not use nickel and half-dollar coins.
Your program will use the following function (amoung others): void computeCoin(int coinValue, int& number, int& amountLeft);

This where i am at but dont know what else to add.

#include <iostream>
using namespace std;

void compute_coins(int coin_value, int& num, int& amount_left);



void compute_coins(int coin_value, int& num, int& amount_left)
{
num = amount_left / coin_value;
amount_left = amount_left % coin_value;
}

int main()
{
int quarters;
int dimes;
int pennies;
int change;

compute_coins(25, quarters, change);
compute_coins(10, dimes, change);
pennies = change;

cout << dimes << endl;
cout << quarters << endl;
cout << change<< endl ;

return 0;
}
Topic archived. No new replies allowed.