Effective January 1st of each year, Gabriela receives a 5% raise on
her previous year’s salary. She wants a program that calculates and
displays the amount of her annual raises for the next three years. The
program also should calculate and display her total salary for the
three years.
Annual salary is $10,000. (The raise amounts
are $500.00, $525.00, and $551.25. The total salary is $33,101.25.)
***I am supposed to have a post loop but not sure how to do this****
// keith joyner 10/25/14 ch7ex31
#include <iostream>
#include <iomanip>
using namespace std;
int main ()
//declare variables
const double RATE= 0.05;
double salary= 0.0;
const double raise= 0.05;
int year= 1;
double totalSalary = 0.0;
int counter = 0;
double previousYearsSalary = 0.0;
//enter user input
cout << "Enter First Year's Salary (-1 to stop): " ;
cin >> salary;
//begin loop
{
cout << "Year: = $ " << year << "raise: = $" << raise << endl;
for (raise = salary * RATE);
(salary = salary + raise);
(totalSalary += salary);
cout << "Salary: = $ " << setprecision(2) << fixed << salary << endl;
cout << "Previous Years Salary: = $ " << previousYearsSalary << endl;
} // end for
//update years counter
year += 1;
} while (year < 4);
system ("pause");
return 0;
}// end main function