File not reading data properly.

This is a code that I have been working on with the help of some other people. The code compiles and runs properly, and it puts the basic information into the output file. However, this program is supposed to count the 3, 4, 5, and 6 letter words and place those in the output file yet it yields a result of zero each time. I've checked over the code, closed down Visual and reopened it, and tried a couple other things, but I'm at a loss now. Can anyone see any reason while this code fails to count the 3, 4, 5, and 6 letter words and ouput the totals in a new file? Thank you for any help.

#include <iostream> // for cout, endl
#include <iomanip> // for setw() and setprecision()
#include <fstream> // for ifstream and iostream
#include <string>

using namespace std;

int main ()
{
ifstream inData ;
ofstream outData ;

int count1 ;
int count3 = 0 ;
int count4 = 0 ;
int count5 = 0 ;
int count6 = 0 ;
char inChar ;

inData.open ("QUOTES.txt");
outData.open ("NUMWORDS.txt");


while (inData)
{
count1 = 0;
inData.get (inChar);
while (inChar >= 'A' && inChar <= 'Z' || inChar >= 'a' && inChar <= 'z')
{
inData.get (inChar);
count1 ++;
}
if (count1 == 3)
count3 = count3 ++;
else
if (count1 == 4)
count4 = count4 ++;
else
if (count1 == 5)
count5 = count5 ++;
else
if (count1 == 5)
count5 = count5 ++;
else
if (count1 == 6)
count6 = count6 ++;
}
outData << "3 letter words: ";
outData << count3 << endl;
outData << "4 letter words: ";
outData << count4 << endl;
outData << "5 letter words: ";
outData << count5 << endl;
outData << "6 letter words: ";
outData << count6 << endl;
outData << "\n";
inData.close ();
inData.clear ();
}
Please edit your post and put the source inside code tags.
Topic archived. No new replies allowed.