Hi, I am very new to C++ and I my program is not working and I can't see why.
Here is my code, basically I am trying to find out if I invest a certain amount of money at an interest rate, how long will it take to buy a car which has a certain depreciation rate. Any help would be extremely appreciated.
Thanks!
#include <iostream>
using namespace std;
int main()
{
int Invest;
int InterestRate;
int CarPrice;
int Depreciation;
int InvestGrow;
int CarDecrease;
int Year = 0;
cout << "Please enter the amount of money you have to invest (in dollars):" << endl;
cin >> Invest;
cout << "Please enter the interest rate earned on the invested amount (in percent):" << endl;
cin >> InterestRate;
cout << "Please enter the current value of your dream car (in dollars): " << endl;
cin >> CarPrice;
cout << "Please enter the depreciation rate for the car (in percent):" << endl;
cin >> CarPrice;
//While loop that runs 5 times - from 1 to 5
while (InvestGrow <= CarDecrease)
{
Year = Year + 1;
InvestGrow = (Invest + (Invest * (InterestRate/100)));
CarDecrease = (CarPrice - (CarPrice *(Depreciation/100)));
//Text output
cout << "At the end of year " << Year << " you have $" << InvestGrow << "and the car now costs $" << CarDecrease << "." << endl;