How to figure out if a word is already in a file? If it is, increase the count by 1, if not, add the word to the vector.

//How to figure out if a word is already in a file? If it is, increase the count by 1, if not, add the word to the vector.
//Also, the comparison is case sensitive.
#include <vector>
#include <cctype>
#include <string>
#include <fstream>
using namespace std;


ifstream openFile;


struct data
{
string word;
int appear;
int length;
};

string read(vector<data>);
string insert(vector<data>&, int);


int main()
{

vector<data> structures;
read(structures);

return 0;

}

string read(vector<data> poem)
{
int count = 0;
vector<string>logs;
string line;

openFile.open("dataIn.txt");
while(!openFile.eof())
{
getline(openFile, line);
logs.push_back(line);
count++;
}
openFile.close();

insert(logs, count);

}
string insert(vector<string> numbers, int appear)
{

int count = 0;
for (int i = 0; i < numbers.size(); i++)
{

}
return numbers;
}
Did not understand your question.
Topic archived. No new replies allowed.