fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. const int iMaxYear = 7 , iStartValue = 1 , iDeprPerYear = 4000;
  6. int iValue = 28000 , iAcc = 0 , iYear = 0;
  7.  
  8. iYear = iStartValue;
  9.  
  10. cout << " END-OF-YEAR ACCUMULATED" << endl;
  11. cout << "YEAR DEPRECIATION VALUE DEPRECIATION\n"
  12. << "---- ------------ ----------- ------------\n";
  13.  
  14.  
  15. while (iYear <= iMaxYear) {
  16. iValue -= iDeprPerYear;
  17. iAcc += iDeprPerYear;
  18. cout << iYear << setw(16) << iDeprPerYear << setw(30) << iValue << setw(50) << iAcc << endl;
  19. iYear++;
  20. }
  21. return 0;
  22. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:18:33: error: ‘setw’ was not declared in this scope
         cout << iYear << setw(16) << iDeprPerYear << setw(30) << iValue << setw(50) << iAcc << endl;
                                 ^
stdout
Standard output is empty