/*
* 烟台大学计算机学院学生
*All right reserved.
*文件名称:c#
*作者:孔云
*完成日期:2014年10月16日
*版本号:v1.0
*对任务及求解方法的描述部分:使用泛型类Stack<T>,实现字符串或数字的反序。
*我的程序:
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Stack<char> st = new Stack<char>();
char[] t = {'E','I','7','9','W','H','2'};
for (int i = 0; i <t.Length; i++)
{
st.Push(t[i]);
}
Console.WriteLine("反序后:");
for (int i = 0; i < t.Length; i++)
{
Console.Write(st.Pop());
}
Console.ReadLine();
}
}
}
泛型求反序
最新推荐文章于 2025-05-21 17:25:27 发布
