发一贴。庆祝下偶写的第一个C#程序。using System;
class Hello
{
static void Main()
{
//System.Console.WriteLine("Hello World!");
//Console.WriteLine("Hello World!");
}
}[辰星 (5-4 3:02, Long long ago)]
[ 传统版 |
sForum ][登录后回复]1楼
第二个。。using System;
class Stack
{
private Node first=null;
public bool Empty()
{
return (first==null);
}
public object Pop()
{
if(first==null)
throw new Exception("Cann't Pop from an empty Stack.");
else
{
object temp=first.Value;
first=first.Next;
return temp;
}
}
public void Push(object o)
{
first=new Node(o,first);
}
public void Push(object o1,object o2)
{
Push(o1);
Push(o2);
}
}
class Node
{
public Node Next;
public object Value;
public Node(object value)
{
Value=value;
Next=null;
}
public Node(object value, Node next)
{
Next=next;
Value=value;
}
}
class Test
{
public static void Main()
{
Stack s=new Stack();
for(int i=0;i<10;i++)
{
s.Push(i);
}
s.Push(-10,-20);
while(!s.Empty()
{
Console.WriteLine(s.Pop());
}
}
}
[辰星 (5-4 3:06, Long long ago)]
[ 传统版 |
sForum ][登录后回复]2楼
(引用 辰星:第二个。。using System;
class Stack
{
private Node first=null;
public bool Empty()
{
return (first==null)...)^o^假期终于干了一件有意义的事情。。
妖妖姐偶要桃桃。。[辰星 (5-4 3:07, Long long ago)]
[ 传统版 |
sForum ][登录后回复]3楼
昨天晚上在canteen看见楼主了[只是看看 (5-4 13:22, Long long ago)] [ 传统版 | sForum ][登录后回复]4楼