今天翻垃圾的时候翻到的,呵呵,怀念一下
//回文判断2
#include <stdio.h>
#include ".\core\core.h"
int main(void)
{
int exp,i,value,length;
char buffer[80];
class Integer* integer;
class Stack* stack;
printf("%s","please input words:");
scanf("%s",buffer);
length = strlen(buffer);
stack = $Stack(&exp);
for( i=0; i<length; i++ )
stack->push(stack,$Integer(buffer[i],&exp)->interface,&exp);
for( i=0; i<length; i++ )
{
integer = stack->pop(stack,&exp)->implements;
value = integer->getValue(integer,&exp);
integer->destroy(integer,&exp);
if( buffer[i] != value ) break;
}
printf("%s\n",((i==length)?"true":"false"));
stack->destroy(stack,&exp);
return 0;
}