Valmont, I'm doing the same thing as Andrew, except a different way... What am I doing wrong??
Code:
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
int main()
{
int i = 0;
string word, wordreverse;
unsigned size;
ifstream in_file("c://Temp//scrabble.txt"); // open a file at this location
while( !in_file.eof() )
{
while( in_file >> word )
{
size = word.size(); // count number of letters in the word
while( i < size ) // while i is less than size, reverse the word
{
wordreverse += word[size-i-1];
i++; // increment i
}
if( word == wordreverse ) // compare the two words
{
cout << word << " is a palindrome." << endl; // if palindrome
}
}
}
system("PAUSE");
return 0;
}