Code:
#include <iostream>
#include <string>
#include <fstream>
#include <algorithm>
#include <cctype>
using namespace std;
int main()
{
string filename = ("file.txt");
ifstream fin(filename.c_str());
ofstream formatout("format.txt");
string word;
while(getline(fin, word, '\n'))
{
transform(word.begin(), word.end(), word.begin(), (int(*)(int))tolower);
for(int i = 0; i != word.size()-1; i++)
{
if(word[i] == '-')
{
word[i] = ' ';
}
}
formatout << word << "\n";
}
fin.close();
formatout.close();
}
}
that my post on how id do it, if youd prefer to use your way, i
need you to post your text file, or at least a good portion of it
so i have something to test. but your error is comming
from isalpha().