The way you are comparing looks to be ok.
Perhaps there's a problem with the tokenising part? Dunno not really looked at it properly, looks too much like C.
iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439
#include
#include
#include
You must be using an ancient c++ compiler -- maybe Turbo C++? If you want to learn c++ language you will have to toss that compiler into the bit bucket and get a modern one -- Dev-C++ is a good one.
Ancient Dragon
Retired & Loving It
30,050 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
Toss out all that C code and replace it with c++. use std::string and >> insert operator and you don't have to do any tokenizing at all. Here's an example
#include <iostream>
#include <fstream>
#include <string>
#include <algorithm>
using namespace std;
int main()
{
string word;
// stay in the loop until you press Ctrl+Z <Enter>
while( cin >> word )
{
// convert the word to lower-case
transform(word.begin(),word.end(),word.begin(),::tolower);
// now find the word in the database (not shown here)
cout << word << endl;
}
cout << "done " << endl;
return 0;
}
Ancient Dragon
Retired & Loving It
30,050 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343