count words with vectors

I am writing a program that can count words, here is my code so far, but every time i run it, there is an error that I dont understand, can anyone help me with this?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#include <iostream>
#include <cstdlib>
#include <fstream>
#include <string>
#include <vector>
#include <cctype>

using namespace std;

string toLower (string str);
string eraseNonAlpha (string Ast);
string wordWasher (string str);

int countUniquenum (vector <string> &v);

int main ()
{
	ifstream infile;
	string word;
	string words = wordWasher(word);
	infile.open("bible.txt");
	if (infile.fail())
	{
		cout << "File failed to open!" << endl;
		system ("Pause");
		return 0;
	}

	while (!infile.eof())
	{
		infile >> words;
	}

	vector <string> v;
	v.push_back(words);
	int unique = countUniquenum(v);
	cout<<unique<<endl;
	infile.close();

	system("pause");
	return 0;
}

string toLower(string str)
{
	for (int i=0; i<str.length(); i++)
	{
		if (str[i] >='A' && str[i]<='Z')
			str[i] = str [i] + 32;
	}

	return str;
}

string eraseNonAlpha(string str)
{
	for (int i=0; i<str.length(); i++)
	{
		if(!((str[i]>='A' && str[i] <= 'Z')|| (str[i] >= 'a' && str[i] <= 'z'))) 
		{str.erase(i,1); --i;}
	}
	return str;
}

string wordWasher (string str)
{
	str = eraseNonAlpha (str);
	str = toLower (str);
	return str;
}

int countUniquenum (vector <string> &v)
{
	int count = 0;
	for (int i=0; i<v.size(); i++)

	{
		if (v[i] != v[i+1])
			count ++;
	}
	return count;
}
please? anyone?
Why do we shall guess what is the error?!
Topic archived. No new replies allowed.