#include
main()
{
ifstream infile;
ofstream outfile;
char name[]="Electricity_Bill.txt";
const int max=100;
char line[max];
outfile.open(name, ios::out);
outfile<<" Electricity Consumer Bill\n ";
outfile<<"---------------------------------------------------------------------------\n";
outfile<<"Reference No Tariff Load Old A/C No\n";
outfile<<"123456789123456 2 1 123456789123456\n\n ";
outfile<<"---------------------------------------------------------------------------\n";
outfile<<"Name and Address \n ";
outfile<<"XYZ Lahore Pakistan \n \n";
outfile<<"---------------------------------------------------------------------------\n";
outfile<<"Reading MF Total Unit Consumed Total Cot of electricity \n";
outfile<<"55671 1 328 9999\n";
outfile<<" \n";
outfile<<"---------------------------------------------------------------------------\n";
outfile<<"Month Units Bill Current Bill 10732\n";
outfile<<"Jan-11 312 5000 Arrears 0\n";
outfile<<"Feb-11 312 5000 Tariff Subsidy NA\n";
outfile<<"Mar-11 312 5000 Payable within Duedate 10732 \n";
outfile<<"\n";
outfile<<"---------------------------------------------------------------------------\n";
outfile.close();
infile.open(name);
if (!infile)
{
cout << "Can't open input file named " << name << endl;
}
while (!(infile.eof()))
{
infile.getline( line,max);
cout << line << endl;
}
infile.close();
system("pause");
}
No comments:
Post a Comment