Where did i go wrong in my code for word count C++ : Hey guys I'm having trouble my code wont count characters if I go to a new line, and for some reason will pick up chars in addition to spaces, where did I go wrong?? (I cant use strings only char and arrays)


void wordCount(ifstream& in_stream, ofstream& out_stream)
{
	int counter = 0,i;

	char next,last[5];
	in_stream.get(next);
	while (!in_stream.eof())
	{
		if (next == ' ')
			(next >> last[5]);
		


		for(i = 0; last[i] != '\0'; ++i)
		{	
			if (last[i] == ' ')


					counter++;
			
		
		}
		
		in_stream.get(next);

	}




	