The code you'll see is a palindrome checker. Every function works, and it will successfully compare a string to determine if it is one or not, and it outputs the appropriate message.
However, it's only set to handle one input at a time. I'm trying to figure out how to create a while loop that will pass each string looped through all the functions and cout the appropriate message for each one.
I know it would look something like
while (x != end)
getline etc
but that only stores and checks 'end' since it will be the last thing entered.
How can I pass all of the looped inputs through my functions?
getline(cin, x);
p = x;
xx=x;
x = Pal(x);
x = Reverse(x);
x = Filter(x);
p = Pal(p);
p = Filter(p);
if ( p == x )
{
cout << xx << " is a palindrome." << endl;
}
else
{
cout << xx<< "is NOT a palindrome." << endl;
}
Within a while loop. The while loop could either iterate the number of times the user wants to give input or until a the input string is given a specific value (eg. x = "exit")
From what I have understood you want the user to be able to keep checking for palindromes more than once. If you want the user to be able to input more than one string at a time and get all outputs at the same time then you need to use a vector.
char choice = 'Y';
while (std::toupper(choice) == 'Y')
{
// your code here.
std::cout << "\n Prompt to continue: ";
std::cin >> choice;
}
For your header files:
"#include <bits/stdc++.h> " is not a standard C++ header file. Also it will include all the C++ versions of the header files you just included. It is best not to use this header file.
"stdio.h" is covered by "iostream" and is not needed mostly because you have no C code that needs it.
"ctype.h" should be "cctype".
"local.h" should be "local". Although I do not believe there is anything in your code that needs this file.
"limit.h" should be "limits". Again I do not believe there is anything in your code that needs this file.