Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C++ (http://www.go4expert.com/forums/cpp/)
-   -   Help with a C++ Program (http://www.go4expert.com/forums/help-cpp-program-t23431/)

golf_girl32 28Sep2010 09:39

Help with a C++ Program
 
I'm supposed to be writing a program for a mortgage calculator. I seem to be stuck and am quite frustrated. If someone could offer some advice that would be amazing. We are supposed to be sticking strictly to call-by-value and call-by-reference.

here is what I was so far

Code:

#include <iostream>

void get_input(int& principle, double& annual_rate, int& length_years);
//The program receives three inputs from operator

void conversions (double& annual_rate, double& monthly_rate_decimal, int& length_years, int& length_months);
//Converts annual interest rate to the monthly interest rate

double monthly_payment (int& principle, double& monthly_rate_decimal, int& length_months, double monthly_payment);
//Computes and prints the monthly payment

void monthly_amounts;
//Computes the remaining values in the amortization table

void print_payment_table;
//Prints values of monthly interest, principal payment and new principle balance

void print_header;
//Prints the header of the amortization table

int main()

{
    int (first_num, second_num, third_num);

    get_input (first_num, second_num, third_num);
    conversions (first_num, second_num);
    monthly_payment (first_num);
    monthly_amounts (first_num, second_num, third_num);
    print_payment_table;
    print_header;
}

{

int prin;
    cout<<"Please enter the principal: ";
    cin>>prin;

double rate;
    cout<<"Please enter the annual interest rate: ";
    cin>>rate;
    1>=rate<=10;

int years;
    cout<<"Please enter the length of the loan (in YEARS): ";
    cin>>years;
}


golf_girl32 28Sep2010 10:48

Re: Help with a C++ Program
 
I have progressed a bit more but now the program isn't letting me type anything. Any ideas of what is causing this?
Code:

#include <iostream>

void get_input(int& principle, double& annual_rate, int& length_years);
//The program receives three inputs from operator

void conversions (double& annual_rate, double& monthly_rate_decimal, int& length_years, int& length_months);
//Converts annual interest rate to the monthly interest rate

double monthly_payment (int principle, double monthly_rate_decimal, int length_months, double monthly_payment);
//Computes and prints the monthly payment

void monthly_amounts (int principle, double monthly_rate_decimal, double m_interest_payment, double m_principle_payment);
//Computes the remaining values in the amortization table

void print_payment_table (double m_interest_payment, double m_principle_payment, double new_principle);
//Prints values of monthly interest, principal payment and new principle balance

void print_header (char print_header);
//Prints the header of the amortization table

int main()
{
 int principle, length_years, length_months;
 double annual_rate, monthly_rate_decimal;
 char print_header;
}

void get_input(int& principle, double& annual_rate, int& length_years)
{

using namespace std;

cout<<"Please enter the principal: /n";
cin>>principle;

cout<<"Please enter the annual interest rate: ";
cin>>annual_rate;

cout<<"Please enter the length of the loan (in YEARS): ";
cin>>length_years;

}


jimblumberg 28Sep2010 18:44

Re: Help with a C++ Program
 
In your main function:
Code:

int main()
{
        int principle, length_years, length_months;
        double annual_rate, monthly_rate_decimal;
        char print_header;
}

Where are you calling any of your functions?

Please use code tags.


Jim


All times are GMT +5.5. The time now is 16:11.