c++ i need help a little!

Status
Not open for further replies.

doughboyy

Baseband Member
Messages
29
Location
USA
Hey, I've been on this program for the past 4 hours and I can't figure this out. It's is asking me to write a program that ask for the principal, the interest rate, and the number of times the interest is compounded.

I think all my cout statement/cin is good, I don't really know how to write the formula.

#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main()
{
int years;
double principal,
interest,
interestRate,
total,
amount;

cout << "Please enter the amount deposited into the account. \n";
cout << "Do not use commas between numbers: ";
cin >> principal;
cout << "Enter the interest rate on this account in the format .05 <for 5%>: ";
cin >> interestRate;
cout << "Enter the number of lines the interest is compounded annually: ";
cin >> years;
cout << endl;

cout << " --- Earning Report ---" << endl << endl;
cout << "Interest Rate: " << setw(12) << interestRate << "%" << endl;
cout << "Times Compounded " << setw(10) << years << endl;
cout << "Principal: " << setw(12) << "$ " << principal << endl;
cout << "Interest: " << setw(13) << "$ " << endl;
cout << "Amount in Savings: " << setw(4) << "$ " << endl;

return 0;
}
 
Status
Not open for further replies.
Back
Top Bottom