my current code is below, but first, here are my error messages (some of them seem really strange). if I don't get this done by monday, life as I know it will come to a crashing halt.
11 C:\Program Files\Dev-Cpp\include\c++\3.3.1\backward\iomanip.h:31, from C:\TEMP\hopewll.cpp In file included from C:/Program Files/Dev-Cpp/include/c++/3.3.1/backward/iomanip.h:31, from C:/TEMP/hopewll.cpp
11 C:\TEMP\hopewll.cpp from C:/TEMP/hopewll.cpp
2 C:\Program Files\Dev-Cpp\include\c++\3.3.1\backward\backward_warning.h:32 #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the header for the header for C++ includes, or instead of the deprecated header . To disable this warning use -Wno-deprecated.
C:\TEMP\hopewll.cpp In function `int main()':
49 C:\TEMP\hopewll.cpp `SWITCH' undeclared (first use this function)
(Each undeclared identifier is reported only once for each function it appears in.)
50 C:\TEMP\hopewll.cpp syntax error before `{' token
54 C:\TEMP\hopewll.cpp case label `1' not within a switch statement
55 C:\TEMP\hopewll.cpp case label `2' not within a switch statement
58 C:\TEMP\hopewll.cpp case label `3' not within a switch statement
59 C:\TEMP\hopewll.cpp case label `4' not within a switch statement
60 C:\TEMP\hopewll.cpp case label `5' not within a switch statement
62 C:\TEMP\hopewll.cpp `default' label not within a switch statement
53 C:\TEMP\hopewll.cpp break statement not within loop or switch
57 C:\TEMP\hopewll.cpp break statement not within loop or switch
64 C:\TEMP\hopewll.cpp break statement not within loop or switch
/TEMP/hopewll.cpp C:\TEMP\C At global scope:
68 C:\TEMP\hopewll.cpp `water' was not declared in this scope
68 C:\TEMP\hopewll.cpp ISO C++ forbids declaration of `IF' with no type
WELL, THERE ARE A LOT MORE, SO I'LL LET IT GO FROM HERE.
//*****************************PRE PROCESSORS***********************************
#include
#include
#include
//**********************************MAIN****************************************
int main ()
{
const double SAN_CHARGE = 12.50,
TAX_RATE = 0.07;
char account [6], // No dashes
date [20]; // Month Day, Year
ofstream outfile;
int children;
long int electric,
water;
double bal_due,
elec_chrg,
school_fee,
tax,
tot_chrg,
water_chrg;
cout << "Enter today's date:" << endl;
cin.getline (date, sizeof (date));
cout << "Enter the account number:" << endl;
cin.getline (account, sizeof (account));
cout << "Enter the number of children in the household:" << endl;
cin >> children;
cout << "Enter the number of gallons of water used in the household:" << endl;
cin >> water;
cout << "Enter the amount of electricity used in the household (in kwh):" << endl;
cin >> electric;
SWITCH (children)
{
case 0:
school_fee = 100.00;
break;
case 1:
case 2:
school_fee = 200.00;
break;
case 3:
case 4:
case 5:
school_fee = 250.00;
default:
school_fee = 300.00;
break;
}
IF (water < 1500){
water_chrg = .0125;}
ELSE IF (water == 1500){
water_chrg = 21.20;}
ELSE IF (water <= 1999){
water_chrg = 21.2142;}
ELSE IF (water == 2000){
water_chrg = 25.85;}
ELSE{
water_chrg = 25.8665;}
IF (electric < 400){
elec_chrg = .053;}
ELSE IF (electric == 400){
elec_chrg = 21.20;}
ELSE IF (electric <= 699){
elec_chrg = 21.261;}
ELSE IF (electric == 700){
elec_chrg = 39.50;}
ELSE IF (electric <= 999){
elec_chrg = 39.573;}
ELSE IF (electric == 1000){
elec_chrg = 61.40;}
ELSE{
elec_chrg = 61.488;}
tot_chrg = school_fee + water_chrg + elec_chrg + SAN_CHRG;
tax = TAX_RATE * tot_chrg;
bal_due = tax + tot_chrg;
cout << "Direct output to the console (1) or to a disk file (2): ";
cin >> choice;
if (choice == 1)
outfile.open ( "con" );
else
outfile.open ( "a:result.dta" );
outfile << setiosflags (ios::showpoint | ios::fixed) << setprecision (0);
outfile << setw(47) << "Town of Hopewell" << endl;
outfile << setw(47) << "----------------" << endl << endl;
outfile << "Date: " << endl << endl;
outfile << "Account: " << endl << endl;
outfile << setw(20) << "Children" << setw(13) "School Fee" << setw(18)
<< "Water (gallons)" << setw(15) << "Water Charge" << endl;
outfile << setw(20) << children << setw(13) school_fee << setw(18)
<< water << setw(15) << water_chrg << endl << endl;
outfile << setw(26) << "Electric (kwh)" << setw(19) "Electric Charge" << setw(21)
<< "Sanitation Charge" << endl;
outfile << setw(26) << electric << setw(19) elec_chrg << setw(21)
<< SAN_CHRG << endl << endl;
outfile << "Total Charge: " << endl << endl;
outfile << "Tax: " << endl << endl;
outfile << "Balance Due: " << endl << endl;
outfile.close ( );
}