链表不是这么写的http://www.shrinkrays.net/code-snippets/csharp/linked-list-and-double-linked-lists-in-csharp.aspx
解决方案 »
- 关于https的post
- .NET Webbrowser内存泄露
- 新手求指导
- 求MVC配置http://域名/1234格式路由的方法,在线等
- 请问如何用代码把浏览器的地址栏去掉??
- 询问解决之道
- 高分求,一个简单的正则表达式!
- 请教:我用C#做了一个WEB系统,现在想在这个系统中用ActiveX来读取客户端C盘的某个txt文件,我是新手,希望能提供简单例子,请各位高手相
- 在C#.net中,当用户登陆网站时如何获取其公网的IP地址?
- C# SFPT传输文件 只能传送文件,不能建立文件夹
- 求助,誰有關于QRCode的代碼
- 如: 发票的税率是7%, 那么开5000的票后要额外交5000*7%=350 元的税 我想把350元的税也开到票里,不知票要开多少金额才对?? ....
using System.Collections.Generic;
using System.Text;
//程序主要功能是用随机数生成两个链表,并输出
namespace test2
{
class count
{
public int number;
public count next;
}
class Program
{
static void Main(string[] args)
{
czMath cz = new czMath();
count head1 = new count();
count head2 = new count();
cz.add(ref head1);
count current1 = head1;
while (current1 != null)
{
Console.Write("\0\0{0}", current1.number);
current1 = current1.next;
}
Console.WriteLine();
cz.add(ref head2);
count current2 = head2;
while (current2 != null)
{
Console.Write("\0\0{0}", current2.number);
current2 = current2.next;
}
Console.WriteLine();
Console.ReadLine();
}
} class czMath
{
static int GetRandomSeed()
{
byte[] bytes = new byte[4];
System.Security.Cryptography.RNGCryptoServiceProvider rng = new System.Security.Cryptography.RNGCryptoServiceProvider();
rng.GetBytes(bytes);
return BitConverter.ToInt32(bytes, 0);
} public void add(ref count head)
{
count current;
count temp;
Random ran = new Random(GetRandomSeed());
current = head;
current.number = ran.Next(100);
current.next = null;
for (int i = 0; i <= 5; i++)
{
temp = new count();
temp.number = ran.Next(100);
temp.next = null;
current.next = temp;
current = current.next;
}
}
}
}