palindrome using stack and queue

Write your question here.



create a program that will allow the user to enter a sentence/phrase your program can able to return the palindrome of the given sentence/phrase

for implementation use the ff. a)stack or linked list b)queue


so far this is my code



#include <iostream>
#include <fstream>
#include <cstring>


using namespace std;

int main(void){
char word[81];
do{
bool palindrome=true;


cout << "Please enter a word" << endl;
cin>>word;
int length = strlen(word);
for (int i=0; i<length; i++){
word[i] = toupper(word[i]);
}
int(length/2);
if (length>0){
for(int i=0;i<(length);i++)
{
if(word[i]!=word[length-1-i])
palindrome=false;
}
}
if(palindrome==true)
{
cout << "The word is a palindrome" << endl;
}
else
{
cout << "The word is not a palindrome" << endl;
}

} while (word!="END");

return(0) ;

}





closed account (48bpfSEw)
"for implementation use the ff. a)stack or linked list b)queue"

you did not use either stack nor linked list queue...
Topic archived. No new replies allowed.