#include <stdio.h> #include "genlib.h" #include "simpio.h"You must have these lines at the top of your project. If you don't, your program will behave very strangely. Also, make sure that you spell include correctly.
Suppose I charged $10. At the end of the first month, I get a bill for $10.15. Then, I pay it off. Did that take one month or two? I suppose it took like one month and a day.
A better way to put it might be this:
At the end of the first month, the balance is $10.15.
At the end of the second month, the balance is zero.
So, let's stick with the hand-out and call it 2 months. If you want to, you can print out the last month's statistics showing 0 end-of-month balance and 0 minimum payment. For example:
lassie% a.out LOANShark Visa, payment chart. Enter initial balance: 24.00 Month 1: Finance charge = $0.36 End-of-month balance = $24.36 Minimum payment = $13.00 Month 2: Finance charge = $0.17 End-of-month balance = $11.53 Minimum payment = $11.53 Month 3: Finance charge = $0.00 End-of-month balance = $0.00 Minimum payment = $0.00 Duration: 0 years and 3 months
In fact, you can also make the argument that people shouldn't write any programs until they have learned all of C first. This is a valid argument if you are, say, writing commercial software. It also makes all of the projects much easier. However, it ignores the fact that many (not all) people learn how to program by doing the projects. I would like to think of the projects as a learning process rather than a test to see what you have already learned.
Finally, don't worry about submitting the "perfect" program. I won't expect you to be perfect, if you don't expect me to be.