Hi,
here is my problem: I'm writing a small program that needs to read a text file and write the words of this text as a list.
I could only come up with the little piece of code I wrote below and it's not even working. I believe the problem is on line 13 but I'm not so sure.
I would appreciate if you could tell me where the problem is and point me to the right direction.
Also, if you know a more cunning way to do what I intend please do tell me.
Thanks,
#include<iostream>
#include<fstream>
using namespace std;
int main()
{
ifstream iDic("text");
ofstream oDic("rawDic");
char ch;
while (iDic.get(ch))
{
ch= tolower(ch);
if (ch< 'a' || ch> 'z')
iDic.putback('\n');
oDic << ch;
}
iDic.close();
oDic.close();
return 0;
}