I posted last night with this question and I didn't include the coding (DUH). I am getting the error " error C2143: syntax error : missing ';' before '{'
1>c:\documents and settings\user\desktop\c++ programming\midterm2invoice\midterm2invoice\midterm2_invoice.cpp(68) : error C3861: 'While': identifier not found"
Here is the code, everything works until it gets to the While stmt. I've matched up all the braces, I'm stumped I was working on this all day and all night. I know it must be something small I just need another pair of eyes to look at the code.
#include <iostream>
#include <fstream>
#include <iomanip>
#include <string>
using namespace std;
// declare constants
double TECH_DISC = .05;
double SCIENCE_DISC = .04;
double HISTORY_DISC = .03;
double lIT_DIC = .05;
double RELIGION_DISC = .05;
double STATE_TAX = .06;
int main()
{
//Declare and initialize variables
ifstream infile;
int CustomerNumber;
char SubjectCode;
// char Title;
double Price;
int Quantity;
double SubTotalT;
double SubTotalS;
double SubTotalM;
double SubTotalH;
double SubTotalL;
double SubTotalR;
double TotalofInvoice;
double AmtofDisc;
string FirstName;
string LastName;
string Title;
infile.open("mid-term.txt");
if (!infile)
{
cout << "Cannot open the input file." << endl;
cout << "Program terminates!!!" << endl;
return 1;
}
cout << fixed << showpoint << setprecision(2);
infile >> CustomerNumber >> FirstName >> LastName;
cout << "-------------------------------------------------------------------" << endl;
cout << "Customer Number: " << CustomerNumber << setw(30)
<< "Customer Name: " << FirstName << " " << LastName << endl;
cout << "-------------------------------------------------------------------" << endl;
cout << endl;
cout << "Category" << setw(10) << "Title" << setw(25) << "Price" << setw(15) << "Quantity" << setw(15) << "Discount" << endl;
infile >> SubjectCode >> Price >> Quantity;
getline (infile,Title);
cout << setw(4) << SubjectCode << setw(24) << Title << setw(15) << Price << setw(12) << Quantity << endl;
cout << endl;
While (!infile.eof())
{
While (SubjectCode != 'EC')
{
switch (SubjectCode)
{
case 'T':
if Quantity > 5
{
AmtofDisc = (Quantity * Price) * TECH_DISC;
AccumTotal += Quantity * Price;
cout << SubjectCode << Title << Price << Quantity << AmtofDisc;
}
else
{
AmtofDisc = (Quantity * Price) * TECH_DISC;
AccumTotal += Quantity * Price;
cout << SubjectCode << Title << Price << Quantity;
}
break;
} // end switch
} // end 2nd while
} //end 1st while
system ("pause");
return 0;
}