I'm trying to get my program to count the occurences of vector in a file in the same directory as the program. Basic stuff, I just don't know how to get the for(int i = 0; word == "vector"; i++) right i think anyone got advice.
Code:
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
using namespace std;
int main()
{
vector<string> lookfor
vector<string> words;
ifstream in("occurence.txt");
string word;
int number = 0;
while(in >> word)
lookfor.push_back(word);
for(int i = 0;word == "vector"; i++)
number = number + 1;
cout << endl << "The document has " << number << " occurences of the word 'vector'." << endl;
}