My job is to read in a line of data from an input file, remove all white space and punctuation, then check to see whether or not it is a palindrome. The input file is an arbitrary length long including no input. I need to read in a line of data at a time then process it until there is no more data to process.
The output should look something like this.
Input Value: Sit on a potato Pan otis!!!
Is it a palindrome? Yes
Input Value: race car
Is it a palindrome? Yes
Input Value: wooHaaaaa
Is it a palindrome? No
I am very new to Programming so anything that you smarter people can do to help me would be greatly appreciated!
This is what I have right now:
first of all, please use code tags. makes your code a lot easier to read for us! thnks.
first thing i noticed you open the file inside a while loop.
What you need to do is open the file en then get all the data out.
Not open it every time:
1 2 3 4 5 6 7 8 9 10
ifstream inData;
inData.open("InPalindrome.txt");
string sentence;
while(!infile.eof())
{
/* get sentence */
getline (inData,sentence);
/* check palidrome ( I did not check this part )*/
}
I started over because something happened with my visual studio and took a slightly different approach. I posted the new code in a new topic discussion