Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #include "PILHA_SEQ.h"
- int main(){
- char string[1001];
- gets(string);
- struct Pilha pilha;
- iniciaPilha(&pilha);
- int count, tam = strlen(string);
- for(count = 0; count < tam; count++){
- push(&pilha, string[count]);
- }
- char string_invertida[1001];
- for(count = 0; count < tam; count++){
- string_invertida[count] = pop(&pilha);
- }
- string_invertida[count] = '\0';
- if(strcmp(string_invertida, string) == 0){
- printf("A palavra %s e palindromica.\n", string);
- }else{
- printf("A palavra %s nao e palindromica.\n", string);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment