For LOOP Error

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
#include <iostream>
#include <string>

using namespace std;
int main()
{
     double amount;
     int numyears, years;
     double realizable;
     double sv;
     double depreciation;
     double accumulated_dep;
     double book_value_end;

   cout << "Amount of the Depreciable Asset" << endl;
   cin >> amount;
   cout << "Enter the Salvage Value" << endl;
   cin >> sv;
   cout << "Enter the number of Years" << endl;
   cin >> numyears;
   depreciation =(amount-sv)/numyears;
   book_value_end =amount-depreciation;
   accumulated_dep =depreciation;
   cout << "Realizable" << endl;   cout << accumulated_dep << endl;   cout << book_value_end << endl;
   {
      for( (years=0; years==numyears; years++)) break;
      accumulated_dep =accumulated_dep+depreciation;
      cout << accumulated_dep << endl; Realizable =amount-accumulated_dep;
      cout << Realizable << endl;   }

   return 0;
}

the error annoyed me...i dont know what to do....
You have two sets of brackets and have not initialised Realizable as it is capitalised.

1
2
3
4
      for( years=0; years==numyears; years++) break;
      accumulated_dep =accumulated_dep+depreciation;
      cout << accumulated_dep << endl; realizable =amount-accumulated_dep;
      cout << realizable << endl;
Topic archived. No new replies allowed.