Counting characters, then output total

I'm writing a program that counts characters from a file, and outputs the answer to the screen. I've got some code, but I'm really confused on getting the answer I want.

#include <fstream>
#include <iostream>
#include <iomanip>
using namespace std;

int main ()

ifstream FileIn;
ofstream Fileout;
int count=0;
char inchar;"E:\\CFiles\\QUOTES.txt");"E:\\Answers.txt");

while (FileIn)



if (count==3)
count; //What goes here?????????????????

else if (count==4)
count; //And here????????????????

else if (count==5)
count; //And here???????????

else if (count==6)

cout<<"3 letter words "<<??????<<endl;
cout<<"4 letter words "<<??????<<endl;


FileIn.clear ();

What is the problem, exactly?
You might want to get used to using parenthesize with your logical operators.

while( (inchar >= 'A' && inchar <= 'Z' ) || (inchar >= 'a' && inchar <= 'z') )

for example.
Last edited on
Here are the instructions, verbatim: Write a program to read a file called (QUOTES.TXT). Your program will count all 3, 4, 5, and 6 letter words. Display the results in the following format:

3 letter words :xxx
4 letter words: xxx
5 letter words: xxx
6 letter words: xxx

The input for this program comes from a file.
Topic archived. No new replies allowed.