This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How to solve this it doesn't compile this c plus program.PLEASE HELP ME

#include <iostream>
#include <iomanip>
#include <string>
#include <fstream>

using namespace std;

int main()
{
string id;
char mtype;
int yr, sumdist = 0, A = 0, sumchrA, avgChargeA=0;
double mfee, dist, charge;
ifstream inFile;
inFile.open("member.txt");
if (!inFile)
cout << "Unable to open file " << endl;

else
{
cout << left << fixed << setprecision(2);
cout << setw(10) << "ID" << setw(10) << "Type" << setw(10) << "Fee($)" << setw(10) << "Discount($)" << "Charge($)" << endl;


while (!inFile.eof())
{
inFile >> id >> mtype >> mfee;

if (inFile.fail())
break;
else
{

if (mtype == 'A') mfee = 30;
else if (mtype == 'B') mfee = 150;
else if (mtype == 'C') mfee = 210;

if (yr < 2) dist = 0;
else if (yr <= 5) dist = mfee*0.05;
else dist = mfee* 0.08;

charge = mfee - dist;


cout << setw(10) << id << setw(10) << mtype << setw(10) << mfee << setw(10) << dist << charge << endl;
sumdist += dist;
if (mtype == 'A')
{
A++;

sumchrA += charge;

}
}
}

//j. compute average
avgChargeA = sumchrA / A;
//k. print report summary
cout << "No of Type A members = " << A << endl;
cout << "Average Charge for Type A members = " << avgChargeA << endl;
cout << "Total Discount = " << sumdist << endl;
}
inFile.close();//text file step 6
return 0;
}