Hi there,
I am working on a palindrome program which is here:
#include <iostream>
#include <string>
using namespace std ;
int main( )
{
cout << "Insert the word to test: " ;
string word ;
string test ;
int i ;
int j ;
cin >> word ;
cout << "The word you input is " << word << " " << endl ;
test = word ;
for ( i = 0 , j = ( word.size() -1 ); i < word.size(), j >= 0 ; i++, j-- )
{
word.at( i ) = word.at( j );
}
cout << "Original Word is " << test << "\n and new word is " << word << endl;
if (test == word) cout << "Palindromes!";
else cout<<"wrong!" ;
}
Now, it compiles fine and it even works but this line
cout << "Original Word is " << test << "\n and new word is " << word << endl;
showed me that the program doesn't actually works in a sense because for whatever reason in the process of copying from
word.at( i ) = word.at( j );
the character change...When I compile it the compiler returns 2 warnings, but got no idea what that means...any idea?
thanks
warning C4267: '=' : conversion from 'size_t' to 'int', possible loss of data
warning C4018: '<' : signed/unsigned mismatch