need help fast

hey people i need help in this programming thanks for the help in advance....here is wad i have so far i got no idea whats wrong with my program i have 6 errors at the moment...before tat i was able to run the program but now i cant seem to run the program after my third printf.....please i need help fast thank you

#include <stdio.h>
#include <conio.h>
#include <math.h>
void main(void)
{
float monthlyPayment;
float balance;
float interestRate;
float month;
float cout;
printf("Enter the current balance of your loan: ");
scanf("%f", &balance);
printf("Enter the interest rate (compounded monthly) : ");
scanf("%f",&interestRate);
printf("Enter the desired monthly payment : ");
scanf("%f", &monthlyPayment);

if (interestRate >= 1)
{
interestRate = interestRate / 100;

balance = balance * (1 + interestRate / 12) - monthlyPayment;

scanf("After month 1 your balance is $%f", &balance);
}
else (balance > 0);
{
balance = balance * (1 + interestRate / 12) - monthlyPayment;

month = month++;
}
if(balance<monthlyPayment)
{
printf("Last month payment is ", &balance);
balance=balance-balance;

}
else
{
balance = balance * (1 + (interestRate / 12)) - monthlyPayment;
}

printf("You have paid off the loan at this point. Congratulations!");

}
getch () ;

}
Last edited on
And you're not gonna tell us what the problem or aim or


Please use code tags: [code]Your code[/code]
See: http://www.cplusplus.com/articles/z13hAqkS/
use code tags and post your error log
The code is not valid, it has mismatched braces { } .

There is a scanf() which looks like it should be printf().

This line doesn't make sense: else (balance > 0);
Last edited on
Here, now it will compile. all I did was put in a few cout statements to see where it was not working.

Your biggest problem was
float cout;
and
scanf("After month 1 your balance is $%f", &balance);
and a } before getch.

still a lot of work to do. your main problem is trying to do to much too fast.
Do one thing, test it, make sure it works, make sure you understand it, then add one more little thing. I recommend getting your logic down, do the math, then add the rest.

Your logic sux
1
2
3
4
if (interestRate > 1)
else (balance > 0);
if(balance<monthlyPayment)
else


Do it on paper first, if you can do it on paper, you can write the logic.


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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include <iostream>
#include <string>
#include <fstream>
#include <sstream>
#include <stdio.h>
#include <conio.h>
#include <math.h>
using namespace std;

int main()
{
float monthlyPayment;
float balance;
float interestRate;
float month;

printf("Enter the current balance of your loan: ");
scanf("%f", &balance);
printf("Enter the interest rate (compounded monthly) : ");
scanf("%f",&interestRate);
printf("Enter the desired monthly payment : ");
scanf("%f", &monthlyPayment);

cout << balance << endl;
cout << interestRate << endl;
cout << monthlyPayment << endl;


if (interestRate > 1)
   {
   interestRate = interestRate / 100; 
   cout << interestRate << endl;
   balance = balance * (1 + interestRate / 12) - monthlyPayment;
   cout << balance << endl;
   printf("After month 1 your balance is $%f", balance); 
   }
else (balance > 0);
   {
   balance = balance * (1 + interestRate / 12) - monthlyPayment;
   month = month++;
   }
if(balance<monthlyPayment)
   {
   printf("Last month payment is ", balance);
   balance=balance-balance; // may as well say balance=0;
   }
else
    {
    balance = balance * (1 + (interestRate / 12)) - monthlyPayment;
    }

 printf("You have paid off the loan at this point. Congratulations!");
// getch () ; 

}
i really appreciate the help thank you people....with the help i was able to understand and write the program with more logic once again thanks for the help :-)
Topic archived. No new replies allowed.