栈的应用、

1、十进制转二进制

void binaryconversion(int n)
{
	SqStack S;
	int e;
	InitStack(S);
	
	while(n){
		Push(S, n%2);
		n/=2;
	}
	while(!Empty(S)){
		Pop(S, e);
		cout<< e<< " ";
	}
}

2、判断回文数

bool palindrome(char *str)
{
	SqStack S;
	char e;
	int i, len = strlen(str);
	InitStack(S);
	
	for(i=0; i

你可能感兴趣的:(数据结构,数据结构,c++)