Coder's Guild Mailing List

Clarification on previous problem

Posted by Chuck Phillips on 1999-09-16

How can I create a table containing all the families, one per line with 
their total income. Also, adjusted income= income - (5000 * number of 
deductions) and tax rate = adjusted income/100,000 if income <50,00
.50 otherwise

tax = tax rate * adjusted income

mucho gratis in advance!!

chuck


#include <fstream.h>
#include <iomanip.h>

void main(void)
 {
	ofstream report("FAMILY.RPT");

	struct {
		char name[25];
		float income;
	}	families[] = {{"Ralph Jones", 19765.43}, {"Mary Jones", 8532.00},
						  {"Francis Jones", 0.00}, {"Humphrey Atwell", 5678.12},
						  {"Robert Murphy", 13432.20},{"Ellen Murphy", 0.00},
						  {"Paddy Murphy", 0.00},{"Eileen Murphy", 0.00},
						  {"Conan Murphy", 0.00},{"Nora Murphy", 0.00}};
		report << "Name\t\tIncome" << endl;
		for ( int i = 0; i< 3; i++)
			{
				report << setiosflags(ios::left) << setw(16) <<
							 families[i].name;
				report << setw(8) << families[i].income << endl;
			}
		report.close();
   }