I trying to read in from a file but getting runtime errors can some one help
find the .txt file as an attachment
#include<iostream>
#include<set>
#include<stack>
#include<queue>
#include<algorithm>
#include<fstream>
using namespace std;
int main()
{
const int size= 7;
char input[size];
fstream nameFile;
nameFile.open("words.txt");
if(!nameFile)
{
cout<<"error cannot open file"<<endl;
return 0;
}
nameFile.getline(input,size);
set<char> dictionary;
set<char>:: iterator it;
while(!nameFile.eof())
{
for(int i=0;i<size;i++)
{
dictionary.insert(it,input[i]);
//it++;
}
nameFile.getline(input,size);
}
//for(int i=0;i<size;i++)
//{
// dictionary.insert(it,input[i]);
//}
for(it=dictionary.begin();it!=dictionary.end();it++)
{
cout<<" "<<*it;
}
cout<<dictionary.size()<<endl;
cout<<endl;
nameFile.close();
system ("pause");
return EXIT_SUCCESS;
}
// while(!nameFile.eof())
// {
// cout<<dictionary<<endl;