Thread: Newbie to C++ needs help plz!!

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Jan 2008
    Posts
    4

    Newbie to C++ needs help plz!!

    Sorry for bothering yall, I just need help if you dont mind. Im new to c++ programming and I need some help. I tried using other references like some books that i have but they didnt really help.

    Title: Interest Earned

    Assuming there are no deposits other than the original investment, the balance in a savings account after one year may be calculated as

    Amount = Principal * ( 1 + Rate/T ) ^T

    where Principal is the balance in the account, Rate is the annual interest rate, and T is the number of times the interest is compounded during a year. (e.g., T is 4 if the interest is compounded quarterly.)

    Write a program that asks for the principal, the interest rate, and the number of times the interest is compounded. It should display a report similar to the following:

    Interest Rate: 4.25%
    Times Compounded: 12
    Principal: $1000.00
    Interest: $43.33
    Final Balance: $1043.33

    Here is what I have done but I cant finish because Im getting all these errors
    Im using Dev C++ for this.

    Heres what i got:

    Code:
    #include <cstdlib>
    #include <iostream>
    
    using namespace std;
    
    int main()
    {
    
    double TimesCom = 0.0;
    double InterestRate = 0.0;
    double Principal = 0.0;
    double Interest = 0.0;
    double FinalBalance = 0.0;
    
    cout << "Enter the principal balance in the account: ";
    cin >> Principal;
    cout << "Enter the annual interest rate percentage: ";
    cin >> InterestRate;
    cout << "Enter the number of times the interest is compounded (months): ";
    cin >> TimesCom;
    
    //This is where i have trouble I tried the using the formula above  Amount(final balance) = Principal * ( 1 + Rate/T ) ^T
    
    InterestRate = InterestRate / 100;
    
    // This is where i need help I did this to see to find the final balance but it doesnt let me compile because of some problems with it
    
    FinalBalance = Principal * (1 + (InterestRate / TimesCom))^TimesCom;
    
    //I also tried using the pow to get the TimesCom to the power of the formula like so
    
    FinalBalance = Principal * pow(1 + (InterestRate / TimesCom), TimesCom);
    
    //but once i get the Final Balance I assume this is how i get the output of the interest
    
    Interest = FinalBalance - Principal;
    
    cout << "Interest Rate: " << InterestRate << endl;
    cout << "Times Compounded: "<< TimesCom << endl;
    cout << "Principal: "<< Principal << endl;
    cout << "Interest: " << Interest << endl;
    cout << "Final Balance: " << FinalBalance << endl;
    
    
    system("PAUSE");
    return EXIT_SUCCESS;
    
    }
    
    /* 
    
    This is what the outcome should be 
    
    Interest Rate: 4.25%
    Times Compounded: 12
    Principal: $1000.00
    Interest: $43.33
    Final Balance: $1043.33
    
    */
    Thanks for looking and helping
    Last edited by xuder; 01-22-2008 at 08:10 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Newbie needs help plz
    By boffinson in forum C++ Programming
    Replies: 22
    Last Post: 07-29-2006, 03:25 AM
  2. Plz help this newbie
    By Desperate in forum C++ Programming
    Replies: 6
    Last Post: 07-10-2006, 10:26 PM
  3. im newbie to opengl, help plz
    By NecroFromHell in forum C++ Programming
    Replies: 4
    Last Post: 05-14-2006, 08:24 PM
  4. Plz help a coding newbie!
    By Zophixan in forum C++ Programming
    Replies: 7
    Last Post: 11-01-2002, 08:06 AM
  5. HI .. newbie to the board... need some help plz
    By Arwen27 in forum C Programming
    Replies: 3
    Last Post: 04-28-2002, 07:27 AM