文件名称:C#栈和队列的应用实例源码
文件大小:40KB
文件格式:ZIP
更新时间:2018-08-04 02:53:43
栈和队列
C#栈和队列的应用实例源码 private void button1_Click(object sender, EventArgs e) { if (textBox3.Text.Length > 0) { if (IsIDnum(textBox3.Text.Trim())) { int i = Convert.ToInt32(textBox3.Text.Trim()); b.Push(i); str = str + textBox3.Text.Trim() + ","; label4.Text = str; textBox3.Text = ""; } else { textBox3.Text = "必须为数字"; } } else { textBox3.Text = "不能为空"; } } private void button3_Click(object sender, EventArgs e) { if (b.Count == 0) { textBox4.Text = "栈为空"; label4.Text =""; } else { textBox4.Text = b.Pop().ToString(); int n = str.LastIndexOf(","); str = str.Substring(0, n); int m = str.LastIndexOf(","); str = str.Substring(0, m+1); label4.Text = str; } }
【文件预览】:
WindowsApplication4
----WindowsApplication4()
--------bin()
--------Form1.Designer.cs(7KB)
--------Program.cs(478B)
--------obj()
--------Form1.cs(3KB)
--------Form1.resx(6KB)
--------WindowsApplication4.csproj(3KB)
--------Properties()
----WindowsApplication1.suo(28KB)
----WindowsApplication1.sln(946B)