How are the word files stored in a text file.
I am trying to take a word as input from and comparing that word with the words present in my local path.
how to compare the input word to the words in the file.
#include <iostream>
#include <fstream>
using namespace std;
string str;
fstream file;
string word, t, q, filename;
void read()
{
    cout << "Enter the word to search in the dictionary:";
    cin >> str;
    cout << "Your Entered word is :" << str;
    cout << "\nsearching in the librabry(Dictionary).";
    return;
}
void search()
{
    //string str;
    filename = "da1.txt";
    file.open(filename.c_str());
    if (str == word)
    {
        cout << "Found" << word << endl;
    }
    else
    {
        cout << "\nEntered word does not exist in the library." << endl;
    }
    return;
}
int main()
{
    search();
}
I am pretty sure that my word is not being compared to the words in the text.
 
     
     
    