I want to make a simple spell check program. This program return Correct if the word is found in text file or Incorrect if the word is not present in text file. For this I am following this appproach:-
1) Create a text file with 1 word per line in alphabetical order.( just like dictionary words without meanings but only 1 word per line)
**2)**Insert the words from text file into Binary Search tree and check whether the word is present or not upon Input from user.
But, I am not sure how do I get the words from text file into BST.
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
struct node
{
    struct node *left;
    struct node *right;
    char word[100];
}
struct node *root=NULL;
void create()
{
    struct node *newnode;
    newnode=(struct node *)malloc(sizeof(struct node));
    char str[100];
    for (i=0;i<100;i++){
    cout<< a[i]<<endl;
    }
    strcpy(newnode->word,str);
    newnode->left=NULL;
    newnode->right=NULL;
    root=newnode;
}   
void insert()
{
    struct node *newnode,*temp,*parent;
    newnode=(struct node *)malloc(sizeof(struct node));
    char str[100];
    cout<<"enter word to be inserted \n";
    cin>>a[i+1];
    strcpy(newnode->word,str);
    newnode->left=NULL;
    newnode->right=NULL;
    temp=root;
    while(temp!=NULL)
    {
        parent=temp;
        if(strcmp(temp->word,str)<0)
            temp=temp->left;
        else
            temp=temp->right;
    }
    if(strcmp(parent->word,str)<0)
        parent->left=newnode;
    else
        parent->right=newnode;
}
int main() {
    ifstream inFile;
    inFile.open("test.txt");
    if(inFile.fail()) {
    cerr << "Error opening file"<< endl ;
    exit(1);
    }
    string x;
    string a[100];
    int count=0,i=0;
    string str;
    while( !inFile.eof()) {
        inFile >> x;
            a[i]=x;
            count++;
            i++;        
            }
    for (i=0;i<100;i++){
    cout<< a[i]<<endl;
    }
    create();
    insert();
    return 0;
}
Please help me. Thanks in advance!
***
I am able to successfully import the text file into program but not into BST.
I created two classes for Root node and inserting the elements from text file to BST but couldnot do it. 
I dont have idea of how to do it. So please help me.
***
