All pastes #372728 Raw Edit

Unnamed

public text v1 · immutable
#372728 ·published 2007-02-26 07:43 UTC
rendered paste body
#include <iostream>
#include <fstream>
using namespace std;
#include <string>

//Create Function
int countWords();
int countCharacters();



int main()
{

	cout << countWords("txtdata.text");

	

	return 0;
}

int countWords( string txtdata )
{
	ifstream file( txtdata.c_str() );
	int count = 0;
	string temp;
	
	
	while (file >> temp) 
	{
		count = count + 1;
	}
	
	return count;
}