很急噪 发堆垃圾~ 勿看

lijun521 2004-07-26 08:36:40
using System;
using System.Collections;
using System.IO;

namespace sayhello
{
/// <summary>
/// Class1 的摘要说明。
/// </summary>
class Class1
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main(string[] args)
{
//
// TODO: 在此处添加代码以启动应用程序
// Print startup banner
Console.WriteLine ("\nQuickSort C#.NET Sample Application");
Console.WriteLine ("Copyright (c)2鬼东西,对汉字就不管用了 考来的 001-2002 Microsoft Corporation. All rights reserved.\n");
Console.WriteLine ("MSDN ACADEMIC ALLIANCE [http://www.msdnaa.net/]\n");



// Describe program function
Console.WriteLine ("吗的,不要废话这么多,偶要生气了!!!!");
Console.WriteLine ("sorting its contents, and writing them to a new file.\n\n\n\n");

//上面都是很简单的东西



// Prompt user for filenames
Console.Write ("Source: ");
string szSrcFile = Console.ReadLine ();
Console.Write ("Output: ");
string szDestFile = Console.ReadLine ();//readline就是等待输入的方法


//这个也容易
// Read contents of source file
string szSrcLine;

ArrayList szContents = new ArrayList ();//arrylist是数组

FileStream fsInput = new FileStream (szSrcFile, FileMode.Open, FileAccess.Read);//这里很麻烦了,读入文件是不是
StreamReader srInput = new StreamReader (fsInput);
//这两个东西就很不东了,文件流??? 读这个流????这些参数是什么意思????!!!!!!

while ((szSrcLine = srInput.ReadLine ()) != null)//只要文件没有读完
{
// Append to array
szContents.Add (szSrcLine);///这个这个是 什么意思啊????
}
srInput.Close ();
fsInput.Close ();
//这个就是关闭这个流的意思 嘿嘿

// Pass to QuickSort function
QuickSort (szContents, 0, szContents.Count - 1);//调用什么QUICKSORT 函数,不就是进行排序吗


// Write sorted lines
FileStream fsOutput = new FileStream (szDestFile, FileMode.Create, FileAccess.Write);
StreamWriter srOutput = new StreamWriter (fsOutput);

//这里就换成文件输出流了。。。。。

for (int nIndex = 0; nIndex < szContents.Count; nIndex++)
{
// Write line to output file
srOutput.WriteLine (szContents[nIndex]); //这个是什么意思啊,参数看不动~~~!
}


srOutput.Close ();
fsOutput.Close ();
//这里很明显是关闭的意思

// Report program success
Console.WriteLine ("\nThe sorted lines have been written to the output file.\n\n");
}




// QuickSort implementation
private static void QuickSort (ArrayList szArray, int nLower, int nUpper)//这种函数他吗的谁写的

{
// Check for non-base case
if (nLower < nUpper)
{
// Split and sort partitions
int nSplit = Partition (szArray, nLower, nUpper);
QuickSort (szArray, nLower, nSplit - 1);
QuickSort (szArray, nSplit + 1, nUpper);//不要跟我说还有什么函数前套

}
}
// QuickSort partition implementation
private static int Partition (ArrayList szArray, int nLower, int nUpper)//这又是什么破函数

{
// Pivot with first element
int nLeft = nLower + 1;
string szPivot = (string) szArray[nLower];
int nRight = nUpper;
// Partition array elements
string szSwap;
while (nLeft <= nRight)
{
// Find item out of place
while (nLeft <= nRight && ((string) szArray[nLeft]).CompareTo (szPivot) <= 0)
nLeft = nLeft + 1;
while (nLeft <= nRight && ((string) szArray[nRight]).CompareTo (szPivot) > 0)
nRight = nRight - 1;
// Swap values if necessary
if (nLeft < nRight)
{
szSwap = (string) szArray[nLeft];
szArray[nLeft] = szArray[nRight];
szArray[nRight] = szSwap;
nLeft = nLeft + 1;
nRight = nRight - 1;
}
}
// Move pivot element
szSwap = (string) szArray[nLower];
szArray[nLower] = szArray[nRight];
szArray[nRight] = szSwap;
return nRight;
}
}//看不东,受不了了
//不会写函数怎么办 考 我真的晕死了!!!!!




//
}
...全文
97 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
哈哈007哈 2004-07-27
  • 打赏
  • 举报
回复
大概看了一下呢
apooo 2004-07-27
  • 打赏
  • 举报
回复
我也是!
idda 2004-07-27
  • 打赏
  • 举报
回复
我好奇心很重,让不看偏要看
hjiay 2004-07-27
  • 打赏
  • 举报
回复
我觉得你提醒的很对,我后悔看了,现在头发昏
y1900808y 2004-07-27
  • 打赏
  • 举报
回复

110,538

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧