What I want to do is to insert a blank line every 6 lines in the print out, here is what I have:
// This program produces a loan amortization
#include <iostream>
#include <iomanip>
#include <cmath>
#include <fstream>
using namespace std;
int main()
{
ofstream outfile("A:Mort.txt");
char name[31];
float loan, rate, years, balance, term, payment;
cout << "Enter the name of the mort. recipant. ";
cin.getline(name, 31);
cout << "Loan amount: $";
cin >> loan;
cout << "Annual Interest Rate: ";
cin >> rate;
cout << "Years of loan: ";
cin >> years;
term = pow((1 + rate / 12.0), 12.0 * years);
payment = (loan * rate / 12.0 * term) / (term - 1.0);
outfile.precision(2);
outfile.setf(ios::fixed | ios::showpoint | ios::left);
outfile << "The loan belongs to : " << name << endl;
outfile << "Monthly payment: $" << payment << endl;
outfile << endl;
outfile << setw(10) << "Pay. No.";
outfile << setw(10) << "Interest";
outfile << setw(10) << "Principal";
outfile << setw(10) << "Balance" << endl;
outfile << "-------------------------------------\n";
balance = loan;
for (int month = 0; month < (12 * years); month++)
{
float minterest, principal;
minterest = rate / 12 * balance;
principal = payment - minterest;
outfile << setw(10) << (month + 1);
outfile << setw(10) << minterest;
outfile << setw(10) << principal;
outfile << setw(10) << balance << endl;
balance -= principal;
}
outfile.close();
return 0;
}
So I was thinking I would add :
if ((month%6)==0)
outfile << "Question how do you display a blank line?" ;
For some reason I can't remember how to display a blank line
TIA
Bill