Need real help

Alright, to start with, i know i totally suck at this but i need help. I am supposed to write a program in which a user enters an amount of "$" and it will calculate when it will take for the money to become in to $5000 or more. I'll just show you the question.....


 
 
Last edited on
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*  Program:    $5,000.00 or more
Date:       12/14/13
Description: This programs calculates when it will take for money to become $5,000.00 or greater.          */

#include <cstdlib>
#include <iostream>
#include <string>

using namespace std;

int main()
{
	//  Declaration of Variables and Constants

	double totalAmount = 0;
	double amount = 0;
	double rate = 0.075;
	double counter = 0;

	// Input

	cout << "Enter amount of money you are investing: ";
	cin >> amount;
	cin.ignore();

	totalAmount = amount;

	while (totalAmount < 5000)
	{
		counter++;
		totalAmount = totalAmount + (totalAmount * rate);
	}

	cout << "It will take " << counter << " years for the savings account to be worth $ " << totalAmount << endl;

	cout << endl;
	system("PAUSE");
	return(0);
}
username: Yanson, you are awsome thanks!!!!!!!!
Topic archived. No new replies allowed.