添加Lesson10
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
namespace Lesson10_LinkedList练习
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
LinkedList<int> ints = new LinkedList<int>();
|
||||
Random r = new Random();
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
ints.AddLast(r.Next(1,100));
|
||||
}
|
||||
LinkedListNode<int> temp = ints.First;
|
||||
while (temp != null)
|
||||
{
|
||||
Console.Write(temp.Value + " ");
|
||||
temp = temp.Next;
|
||||
}
|
||||
Console.WriteLine();
|
||||
Console.WriteLine("----------------");
|
||||
temp = ints.Last;
|
||||
while (temp != null)
|
||||
{
|
||||
Console.Write(temp.Value + " ");
|
||||
temp = temp.Previous;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user