trying to get the program to run but there is an error in line 31 (expected primary expression before else) i dont know what to do
// Devin Southern
// COSC 112 - Spring 2009
// Dr Stone
// Lab 9
// This program will use loop to keep track of failing, passing and valid grades
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
// Declaration Section
char letter;
int pass=0, fail=0, valid=0, all=0;
ifstream indata;
ofstream outdata;
indata.open("letters.txt");
outdata.open("letters_out.txt");
// Input
while (indata)
{
if (letter >='a' && letter <='d')
pass++;
all++;
}
else (this is where the error is)
if(letter >='d' || letter <='f')
{
fail++;
valid=(pass+fail);
{
else
outdata<<letter<<endl;
all++;
indata>>letter;
}
outdata<<error<<endl;
outdata<<"There are "<<pass<<" passing grades"<<endl;
outdata<<"There are "<<fail<<" failing grades"<<endl;
outdata<<"There are "<<valid<<" valid grades"<<endl;
outdata<<"There is a total of "<<all<<" characters in the file"<<endl;
outdata.close();
return 0;
}