savings acount in a loop

im trying to learn c++ for the first time and have difficulties with a program where the user writes how much he wants to put in each year, what saving goals he wants to achieve, and his interest rate in percent. i want the loop to figure out how many years it would take and how much he would end up with exactly.
would somone please help me?

#include<iostream>
using namespace std;

int main(){

cout << "how much do you want to put in:";
int in;
cin>>in;

cout<< "how much do you want to save:";
int save;
cin>> save;

cout<< "what is your interest rate in percent: ";
double percent;
cin>> percent;
int total = in*(percent/100+1)
;
while ( total <= save){
totalt+totalt;

cout<<"results, years "<< << < endl;
}
;}

I have spotted an error in line 20
 
total+total; // You don't give the sum to a variable it should be total=total+total; or total=total*2;  " *= X" 
Last edited on
Topic archived. No new replies allowed.