# Need Help With Multi Function Program

• 10-13-2005, 01:49 PM
WackoWolf
Need Help With Multi Function Program
I have been going crazy all night and a good part of today. I can't get pass the build, I think I have my functions wrong. Can someone Please Help Me. I am going nuts. Here is what I have for code.

Thanks

Code:

``` #include "stdafx.h" #include <math.h> //#using <mscorlib.dll> //using namespace System; void display_statement (double, double, double, double, int, double); double Tinterest_paid(double, int); double payment_amount (double, double, int); int main(void) { double a=1; double b=1; double c=1; double d=1; double e=1; double x=1; double i;                    // Interest_Rate Monthly double p;                    // Principal int n  ;                      // Number Payments display_statement double Payment_Amount; double payment; double Total_Amount; double total_amount; double Tamount_paid; double total_interest; double Tinterest_paid(double, int); double payment_amount (double, double, int);         printf("Please Enter Interest Rate ");            // Key As n.n                 scanf("%lf",&i);         printf("Please Enter Loan Amount ");              // Amount of Loan                 scanf("%lf",&p);         printf("Please Number Of Monthly payments ");    // Number Of Monthly                 scanf("%d",&n);         payment = Payment_Amount (i,p,n);     Total_Amount = Tamount_paid(payment,n);     total_interest=Tinterest_paid(total_amount,p); void display_statement (double, double, double, double, int, double); } {         double x;         x = Tinterest_paid(200000, 150000);         printf("The result is\n\n %f', X);                 return 0; } double Tinterest_paid (double amount_paid, double Principal) {         double int_paid;         int_paid = amount_paid - Principal;         return (int_paid); {         double x;         x = Payment_Amount(5.5, 100000, 60); } double Payment_Amount (double Interest_Rate, double Principle, int Number_Payments) {         double a, payment;         a = Interest_Rate/100;         a= a/12;         payment = (a* Principle)/ (1 - pow((1+a), -Number_Payments));         return(payment); } {         display_statement (a, b, c, d, x, e);         return 0; } void display_statement (double payment, double loan_payment, double Tinterest, double Principal, int Number_Payments, double interestrate) {         printf("Monthy Payment: \$%.2f\n\n", payment);         printf("Total Loan Amount; \$%.2f\n\n", loan_Amount);         printf("Total Interest Payment: \$%.2f\n\n", Tinterest);         printf("Principal: \$%.2f\n\n", Principal);         printf("Number Of Payments: %d\n\n", Number_Payments);         printf("Interest Rate %.3f percent\n\n", interestrate); }```
• 10-13-2005, 03:06 PM
Code:

```void display_statement (double, double, double, double, int, double); double Tinterest_paid(double, int); double payment_amount (double, double, int);```
for starters, what's wrong with this picture? ;)
also keep in mind case sensitivity.
• 10-13-2005, 03:32 PM
WackoWolf
Not sure I been at this for the last 13 hours, I am starting to see double. Could you please Help.

Thank You
• 10-13-2005, 03:44 PM

payment = Payment_Amount (i,p,n);
Total_Amount = Tamount_paid(payment,n);
total_interest=Tinterest_paid(total_amount,p);

void display_statement (double, double, double, double, int, double);

}

also, why is this prototype here?
• 10-17-2005, 04:22 PM
Mansur
Hi
Sorry... my English language is bad
I am spend to much time to correct your mistake, but I am don't know what your programming doing exactly.
Be careful to next notes:
1- some time you declare variable "double" and try to use it "int".
2- don't use variable and function same name you will confused.
3- Use one way to give the variable name, don't use x,s,w1…

The program is work now but, must you complete it
I have wrong result when use "scanf" ??? I used "cin"

Finally I try to help you if I am do mistake in my replay I am sorry
Code:

```// program for do something //by your name #include "stdafx.h" #include <math.h> #include <iostream.h> // Declare functions only // function1 for ... double Payment_Amount (double,double,int); //function2 for ... double Tinterest_paid(double, double); // function1 for .... void display_statement (double, double, double, double, double, double); // Declare variables only //double total_amount,total_interest;  // your don't used these variables //double Payment_Amount; //have same function name . int n ;                                                                                                // Number Payments display_statement double Total_Amount,Tamount_paid,p,i,payment; double a=1,b=1,c=1,d=1,e=1,int_paid=1;                                                        // Interest_Rate Monthly int main(void) { //scanf("%lf",&p);         printf("Please Enter Interest Rate ");            // Key As n.n         //                scanf("%lf",&i);         cin >> i;                 printf("Please Enter Loan Amount ");              // Amount of Loan         //        scanf("%lf",&p);         cin >> p;                                         printf("Please Number Of Monthly payments ");    // Number Of Monthly //                scanf("%lf",&n);         cin >> n;                 payment = Payment_Amount (i,p,n);         printf("%f\n",payment);                          //Total_Amount = Tamount_paid(payment,n);  //don't used             //total_interest=Tinterest_paid(total_amount,p); //don't used                         int_paid = Tinterest_paid(200000, 150000);                         printf("The result is %f\n", int_paid);                 display_statement (a, b, c, d, int_paid, e);         return 0; } //function 1 double Payment_Amount (double Interest_Rate, double Principle, int Number_Payments)         {                         a = (Interest_Rate/100)/12;                   payment = (a * Principle)/ (1 - pow((1+a),-Number_Payments));                   return (payment);         } // function2 double Tinterest_paid (double amount_paid, double Principal)         {         int_paid = amount_paid - Principal;         return (int_paid);         } // function 3 void display_statement (double payment, double loan_payment, double Tinterest, double Principal, double Number_Payments, double interestrate) {         printf("Monthy Payment: \$%.2f\n\n", payment);         printf("Total Loan Amount; \$%.2f\n\n", loan_payment);         printf("Total Interest Payment: \$%.2f\n\n", Tinterest);         printf("Principal: \$%.2f\n\n", Principal);         printf("Number Of Payments: %d\n\n", Number_Payments);         printf("Interest Rate %.3f percent\n\n", interestrate); } /*         double x;         x = Payment_Amount(5.5, 100000, 60); }                 {         return 0;         }*/         /*  void display_statement (double, double, double, double, int, double);                 {                                 }         //        double x; */```