工作過程中中,把寫內(nèi)容過程中比較重要的內(nèi)容備份一次,下面內(nèi)容段是關(guān)于C#進行回文檢測的3的內(nèi)容,應(yīng)該是對各位朋友也有用途。
Console.WriteLine("算法3:請輸入一個字符串!");
string str3 = Console.ReadLine();
string s=null;
for (int i = 0; i < str3.Length; ++i)
{
stack.Push(str3[i]);
}
while (stack.Count>0)
{
s +=stack.Pop().ToString();
}
if (str3!= s)
{
Console.WriteLine("這不是回文");
}
else{ Console.WriteLine("這是回文");}
Console.ReadLine();