1. ## Codeing problems

hi,
can any1 help me find the errors in my code. i guess they r logic because the compiler didnt catch anything. this is a program that displays the principle, interest, time, and mortgage payment onto a table on a .dat file. thanx:

/*MP4b.cxx - Prints mortgage payment and bank heading on a table
input: None
output: Principle, Interest, Time, & Mortgage Payment
author: Ryan Fehr
*/

#include <fstream.h>
#include <math.h>
#include <iomanip.h>
int main()
{
float P; //Principle
float I; //Interest
float T; //Time
float MP; //Mortgage Payment
ofstream out_file; //declares out_file
out_file.open("MP4b.dat"); //opens external file MP4b.dat and
//associates it

I = .07;
T = 30;

out_file << setw(32) << "Fat_Rizzle's_Bank\n"
<< setw(46) << "Ryan_Fehr__Executive_Rizzle_CEO\n\n"
<< setw(10) << "Principle"
<< setw(12) << "Intesrest"
<< setw(8) << "Time"
<< setw(22) << "Mortgage_Payment/n";

for(P = 50000; P<=100000; P+= 10000)
{

MP = (P*(I/12))/(1-pow((1/(1+(I/12))),(T*12))); //Calculates
//Mortgage Payment

out_file << setiosflags (ios::fixed)
<< setiosflags (ios::showpoint)
<< setprecision(2); //Sets decimal pl\$
out_file << setw(9) << P;
out_file << setw(9) << I;
out_file << setw(11) << T;
out_file << setw(17) << MP;
}

return 0;
}

2. If the problem is with the file formating then look at newlines \n
Code:
```<< setw(22) << "Mortgage_Payment\n";
...
...
out_file << setw(17) << MP << '\n';```