摘要: C#使用栈判断回文字符串class Program { static void Main(string[] args) { //判断回文数 CStack myStack=new CStack(); string word = "sys"; string ch; bool isHuiWen =true; //栈是LIFO,字符串入栈,出栈时最后一个字符先出。 for (int i = 0; i < word.Length; i++) { myStack.Push(word[i]); } int pos = 0; //出栈字符依次和原字符串字符比较 while (pos 阅读全文
posted @ 2011-02-25 16:08 王海龙(Heaven) 阅读(839) 评论(2) 推荐(1) 编辑