Hi, i'm new to the boards so please don't flame me too much if this is too easy.

I'm trying to read from a file that contains a couple paragraphs of sentences and the point is to read each word and count how many times each word appears in the file. Then output each word and next to it how many times it appeared.

Here's my code so far.

Code:
#include <iostream>
#include <fstream>
#include <cctype>
#include <string.h>
using namespace std;



void readWords();


void main(){

	readWords();

	
	}

//************************************************************************************//
void readWords(){

	char ch = 'a';
	char formWord[100];
	string words[500];
	int i = 0;
	int j = 0;
	int k = 0;
	ifstream infile;

	infile.open("p01.txt");
	if (!infile){
		cout << "Cannot open output file. \n";
	}

	while (!infile.eof()){
        infile.get(ch);
		if ((ch == ' ')||(ch == ',')||(ch == '?')||(ch == '!')||(ch == ':')||(ch == '"')||(ch == '.')){
		    ch = 'a';
			cout << " ";
			words[k] = formWord;
		}
		else{
             formWord[i] = toupper(ch);
	         cout << formWord[i];
	         i++;
	      
		}
	}
	
}
Now I am reading each letter from the file into the character array formWord until it hits a space or one of the punctuation marks, then I try to store the word formed into a string array so I can later output it, but I can't seem to figure out how to do that.

Can anyone help?

Much appreciated.