namespace ConLSP
{
class Program
{
public delegate void GreetingDelegate(string name);

public void Greeting(string name,GreetingDelegate MakeGreeting) { MakeGreeting(name); }
static void Main(string[] args)
{
#region 继承
//Student stu = new Student();
//stu.ShowPerson();

//Person per = new Person();
//per.ShowPerson();


//Person ps = new Student();
//ps.SayHi();
//ps.ShowPerson();
//Console.ReadKey();
#endregion

#region 面试题 字符串
//string strTmp = "abcdefg某某某";
//int i = System.Text.Encoding.Default.GetBytes(strTmp).Length;
//int j = strTmp.Length;
//System.Console.WriteLine(i + "==========" + j);
//Console.ReadKey();

#endregion

#region 练习
//Int32[] number = { 100, 200, 300 };
//Console.WriteLine("修改前:{0},{1},{2}", number[0], number[1], number[2]);
//ChangeValue(number);
//Console.WriteLine("修改后:{0},{1},{2}", number[0], number[1], number[2]);
//Console.ReadKey();
#endregion

#region 冒泡排序
//int[] a = new int[] { 2, 5, 1, 3 };

 

//for (int i = 0; i < a.Length - 1; i++)
//{
// for (int j = i + 1; j < a.Length; j++)
// {
// if (a[i] > a[j])
// {
// int item = a[i];
// a[i] = a[j];
// a[j] = item;
// }
// }
//}


//for (int i = 0; i < a.Length; i++)
//{
// for (int j = 0; j < a.Length-i-1; j++)
// {
// int item;

// if (a[j]>a[j+1])
// {
// item = a[j];
// a[j] = a[j+1];
// a[j+1] = item;

// }
// }
//}
//foreach (var item in a)
//{
// Console.Write(item + "==");
//}


#endregion

#region 递归 1,1,2,3,5,8,13,21......+m 求第30位数字
//Console.Write(Fibonacci(30));
#endregion

#region 100随机数 插入到数组 不能重复
//int[] intarr = new int[100];
//ArrayList mylist = new ArrayList();
//Random rad = new Random();//随机数
//while (mylist.Count < 100)
//{
// int num = rad.Next(1, 101);
// if (!mylist.Contains(num))
// {
// mylist.Add(num);
// }

//}
//for (int i = 0; i < 100; i++)
//{
// intarr[i] = (int)mylist[i];
// Console.Write("{0}", intarr[i]);
// Console.Read();
//}
#endregion

#region 文本创建并写入
//string FILE_NAME = "temp.txt";
//StreamWriter sr;
////判断文件是否存在
//if (File.Exists(FILE_NAME))
//{

// sr = File.AppendText(FILE_NAME);
//}
//else//如果文件不存在。则创建file.CreateText对象
//{
// sr = File.CreateText(FILE_NAME);
//}
//sr.WriteLine("hellow world!");//写入内容
//sr.Close();//关闭流
#endregion

#region 打印星星
//int a = 5; //总共五行
//for (int i = a; i >= 1; i--)
//{
// #region 加上就是等腰倒三角形
// //for (int h = 1; h <= a - i; h++)
// //{
// // Console.Write(" ");
// //}
// #endregion

// for (int j = 0; j < 2 * i - 1; j++)
// {
// Console.Write("*");
// }
// Console.Write("\n"); //换行
//}
//Console.ReadKey();
//int a = 5;
//for (int i = 1; i <=a; i++)
//{
// for (int j = 1; j <= a - i; j++)
// {
// Console.Write(" ");
// }
// for (int h = 1; h <= 2*i-1; h++)
// {
// Console.Write("*");
// }
// Console.Write("\n");
//}
#endregion

#region 求1-2+3-4+……+m的值
//int m = 50;
//int count = 0;
//for (int i = 1; i <= m; i++)
//{
// if (i % 2 == 1)
// {
// count += i;
// }
// else
// {
// count -= i;
// }
//}
//Console.Write(count.ToString());
#endregion

#region MyRegion
int[] arr = new int[100];
int[] result = new int[2];
int[] heap = new int[101];
for (int i = 0; i < 98; i++)
{
heap[arr[i]] = 1;
}
for (int i = 0; i <=100; i++)
{
if (heap[i]!=1)
{
System.Console.Write(i);
}
}
#endregion
Console.Read();

}


#region 递归方法
static int Fibonacci(int n)
{
if (n <= 0)
{
return 0;
}
else if (n > 0 && n <= 2)
{
return 1;
}
else
{
return Fibonacci(n - 1) + Fibonacci(n - 2);
}
}
#endregion

#region 练习方法
public static void ChangeValue(Int32[] k)
{
k[0] = 1;
k = new Int32[3] { 3, 3, 3 };
}
#endregion

}
}