Function does not work!

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
#include <iostream>
using namespace std;
double depreciation (double, int);
double carrying_value (double,double );
double amounts ( double, double);
double accdeps ( double,double);

int main()
{
    double amount, salvage_value, years, count, accdep=0,r;

    cout << "Amount of the Depreciable Asset:" ;
    cin >> amount;
    cout << "Enter the Salvage Value;";
    cin >> salvage_value;
    cout << "Enter the number of Years:";
    cin >>years;
    cout << "Year" "    "<<"Value\t" << "Depreciation Exp." "   " << "Accumulated Depreciation" "   " << "Book Value" << endl;




        for (count=1; count<=years; count++)
            {
                r= carrying_value(amount, depreciation(amount,years));


                cout <<"  " << count << "     " << carrying_value << "\t" "      " << depreciation << "\t\t" "      " << accdeps << "\t\t" "  " << amounts << endl;

            }

        return 0;

}

double depreciation (double amount, int years)
{
    return amount/years;

}

double amounts ( double amount, double depreciation)
{
    return amount -= depreciation;
}
double accdeps ( double accepdep, double depreciation)

    return accdep += depreciation;
}

double carrying_value(double amount, double depreciation)
{

    return amount-depreciation;

}
#
Last edited on
Which one? Whats it doing / not doing?

I see you have too many quotations (") in your couts. could that be your problem?
Last edited on
Line 28: cout <<" " << count << " " << carrying_value << "\t" " " << depreciation etc. You are not calling the functions correctly
eg: ... << carrying_value ( /*value for amount*/, /*value for depreciation*/) << ...
Topic archived. No new replies allowed.