Money counter problem.

Hey guys i have a problem. This is our original homework assignment:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
Write a program to display the  bills and coins dispensed for
check cashing store screen. 
The screen display should have the following format:

Check Amount                $ 814.69
Cashing Fee                    25.00
Amount Dispensed              789.69

Denominations Dispensed:
                      #       Amount
                     ---     -------- 
Hundreds              7       700.00
Fifties               1        50.00 
Twenties              1        20.00
Tens                  1        10.00 
Fives                 1         5.00
Ones                  4         4.00 
Quarters              2          .50
Dimes                 1          .10
Nickels               1          .05
Pennies               4          .04  
                     ---     -------- 
Total Amount                $ 789.69


Here is my code:
header:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
  #ifndef HEADER_H
#define	HEADER_H
int input();
int fee(int& dollar);
void bills(int& dollar, int& hundreds, int& fifties, int& twenties,
        int& tens, int& fives, int& ones);
void coins(int& change, int& quarters, int& dimes, int& nickles, int& pennies);
int display();



#endif	/* HEADER_H */



Main:
1
2
3
4
5
6
7
8
9
10
11
12
13
#include "header.h"
#include <iostream>

int main ()
{
    input();
    
    display();
    
    
    
    return 0;
}


Functions:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#include <string>
#include <cmath>
#include <iomanip>
#include <iostream>
#include "header.h"


using namespace std;


int input() {
    
    int dollar;
    int change;
    char decimal;
    
    cout << "Input the total here: ";
    cin >> dollar >> decimal >> change;
    cout << endl;

    return dollar, change;
}

int fee(int& dollar) {
    int fee;
    if (dollar < 100) {

        fee = dollar - 5;
    } else if (dollar > 100 < 500) {
        fee = dollar - 15;
    } else if (dollar > 500 < 1000) {
        fee = dollar - 25;
    }

    return dollar;
}

void bills(int& dollar, int& hundreds, int& fifties, int& twenties, int& tens, int& fives, int& ones) {
    int remainingAmount = 0;

    hundreds = dollar / 100;
    remainingAmount = dollar - hundreds * 100;

    fifties = remainingAmount / 50;

    remainingAmount -= fifties * 50;


    twenties = remainingAmount / 20;

    remainingAmount -= twenties * 20;


    tens = remainingAmount / 10;

    remainingAmount -= tens * 10;

    fives = remainingAmount / 5;

    remainingAmount -= fives * 5;

    ones = remainingAmount;

}

void coins(int& change, int& quarters, int& dimes, int& nickles, int& pennies) 
{
    quarters = change / .25;
    change -= quarters * .25;

    dimes = change / .10;
    change -= dimes * .10;

    nickles = change / .5;
    change -= nickles * .5;

    pennies = change;

}

int display() {
    string divider(24, '-');
    string small(3, '-');
    string med(8, '-');
    
    //cout<<"Fee Price"<<fee<<endl;
    cout << "Denominations dispensed: " << endl;
    cout << divider << endl;
    cout << setw(24) << "#" << setw(10) << "Amount" << endl;
    cout << setw(25) << small   
         << setw(10) << med << endl;

    cout<<"Hundreds: "<<endl;
    cout<<"Fifties: "<<endl;
    cout<<"Twenties: "<<endl;
    cout<<"Tens: "<<endl;
    cout<<"Fives: "<<endl;
    cout<<"One's: "<<endl;
    cout<<"Quarters: "<<endl;
    cout<<"Dimes: "<<endl;
    cout<<"Nickles: "<<endl;
    cout<<"Pennies: "<<endl;
    
    return 0;
}


My problem is that i cannot get the amounts calculated in the bills() and coins() for the denominations to display in the display(). I have tried putting display(int$ hundreds, //ect....) and got no results only errors. This means i dont even know for sure the calculations are even working correctly as i can not see the displayed number. Please look it over, nit pick it, call me stupid , whatever you need to do.


Thanks!
Topic archived. No new replies allowed.