Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- // Define Year Vars.
- int StartYear, EndYear;
- // Define Inflation & Amount Vars.
- float TotalInflation, AverageYearlyInflation, StartAmount, EndAmount;
- // Prompt for and get Start (index) Year.
- cout << "Enter the starting year (Index Year): ";
- cin >> StartYear;
- //Prompt for and get Start (index) Amount.
- cout << "\nEnter the starting amount (Index Amount): ";
- cin >> StartAmount;
- //Prompt for and get Ending Year.
- cout << "\nEnter the ending year: ";
- cin >> EndYear;
- //Prompt for and get Ending Amount.
- cout << "\nEnter the ending amount: ";
- cin >> EndAmount;
- //Calculate Total Percentage Difference between End Amount and Start Amount.
- TotalInflation = EndAmount/StartAmount;
- //DEBUG: Prints out TotalInflation for Verification
- //cout << "\n\nTotal Inflation: " << (TotalInflation*10) << "%\n"; system("pause");
- //Calculate Average Inflation Amount per Year (TotalInflation/Difference of End & Start Years)
- AverageYearlyInflation = 1+(TotalInflation/(EndYear-StartYear));
- //DEBUG: Prints out AverageYearlyInflation for Verification, Pause After Displaying.
- //cout << "\nAverage Yearly Inflation: " << (AverageYearlyInflation*10) << "%\n"; system("pause");
- //Display Total Inflation, output in user-friendly readable %ile format.
- cout << "\nTotal Inflation: " << (TotalInflation*10) << "%\t\t";
- cout << "Average Rate of Inflation: " << (AverageYearlyInflation*10) << "% per year\n"; system("pause");
- //End main, return 0.
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement