function call error!

I got a problem with my code!

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

{
double amount, r;
int numyears,years;
cout<<"Enter the Value";
cin>>amount;
cout <<"Enter the number of useful years.";
cin >>numyears;

for( ( int year=1; year<=numyears; year++))
r= realizable( amount, depreciation( amount, numyears));
cout<<r;

return 0;

}

double depreciation(double amount, int numyears)
{
return amount/numyears;
cout<< depreciation;
}

double realizable (double amount, double depreciation)
{ 
return amount-depreciation;
cout<<realizable;
}



i am working with a straightline depreciation table.....,,,
Last edited on
Rewrite the for loop as
 
for( int year=1; year<=numyears; year++)

Could you show your error code and which line is error?
Last edited on
Notice this:
1
2
3
4
5
double depreciation(double amount, int numyears)
{
    return amount/numyears; //--------------------
    cout<< depreciation;  //----------------------
}


the function returns
this line  will not be executed
Topic archived. No new replies allowed.