自定义函数
//访问修饰符 函数名(参数1,参数2)
//{
//函数体
//return 返回值
//}
/// <summary>
/// 无参数,无返回值
/// </summary>
public static void abc()
{
Console.WriteLine("无参数,无返回值");
}
/// <summary>
/// 无参数,有返回值
/// </summary>
/// <param name="args"></param>
public static int abc2()
{
return 1;
}
/// <summary>
/// 有参数,无返回值
/// </summary>
/// <param name="args"></param>
public static void abc3(int a,int b)
{
Console.WriteLine(a + b);
}
/// <summary>
/// 有参数,有返回值
/// </summary>
/// <param name="args"></param>
public static int abc4(int x,int y)
{
return x * y;
}
struct stu
{
public int id;
public string name;
public DateTime birthday;
public double mark;
public int age;
}
static void Main(string[] args)
{
//abc();
//Console.WriteLine(abc2());
//abc3(1, 2);
//Console.WriteLine(abc4(2, 3));
//Console.WriteLine("请输入学生数");
//int count = int.Parse(Console.ReadLine());
//Console.WriteLine("请输入学生信息:\n");
//List<stu> st_list = new List<stu>();
//for(int i = 1; i <= count; i++)
//{
// stu st;
// Console.WriteLine("请输入第"+ i +"个学生学号");
// st.id = int.Parse(Console.ReadLine());
// Console.WriteLine("请输入第" + i + "个学生姓名");
// st.name = Console.ReadLine();
// Console.WriteLine("请输入第" + i + "个学生生日");
// st.birthday = Convert.ToDateTime(Console.ReadLine());
// Console.WriteLine("请输入第" + i + "个学生分数");
// st.mark = Convert.ToDouble(Console.ReadLine());
// //Console.WriteLine("请输入第" + i + "个学生年龄");
// st.age = DateTime.Now.Year - st.birthday.Year;
// st_list.Add(st);
//}
//foreach(var x in st_list)
//{
// Console.WriteLine(x.id+ " " + x.name + " " + x.birthday + " " + x.mark +" " + x.age + "\n");
//}
ArrayList alt = new ArrayList();
for(int i = 1; i <= 100; i++)
{
alt.Add(i);
}
for(int i = 49,j = 90; i <= 58&&j<=200; i++,j++)
{
alt.Insert(i, alt[j]);
j++;
}
foreach(int x in alt)
{
Console.WriteLine(x);
}
Console.ReadLine();