The assignment my instructor has assigned as for to read an input file and count all 3, 4, 5, and 6 letter words and out put those to an output file. From what data I had been provided by my instructor, I think he wants us to use char data for the letters/words. I the code below is as far as I have gotten. The result I get is just punctuation.
#include <iostream>
#include <iomanip>
#include <fstream>
using namespace std;
int main()
{
ifstream FileIn;
ofstream FileOut;
FileIn.open ("m:\\QUOTES.txt");
FileOut.open ("m:\\NUMWORDS.txt");
char charin;
int count = 0;
int count3 = 0;
int count4 = 0;
int count5 = 0;
int count6 = 0;
while ( FileIn )
{
FileIn.get ( charin );
count = 0;
while ( charin >= 'A' && charin <= 'Z' || charin >= 'a' && charin <= 'z' )
{
count++;
FileIn.get ( charin );
}
if ( count == 3 )
count3++;
else if( count == 4)
count4++;
if (count == 5)
count5++;
else if( count == 6 )
count6++;
{
}
FileOut << charin;
}
return 0;
}