• 数组


    /* Console.WriteLine("请输入人数");
    int n = int.Parse(Console.ReadLine());
    int[]arr=new int[n];
    for (int i = 0; i < arr.length; i++)
    {
    Console.WriteLine("请输入第"+(n+1)+"个人的成绩");
    arr[i] = int.Parse(Console.ReadLine());
    }
    for (int i = 0; i <arr.length; i++)
    {
    Console.WriteLine(arr[i]);
    }
    Console.ReadLine();*/


    /* Console.WriteLine("请输入人数");
    int n = int.Parse(Console.ReadLine());
    int[] arr = new int[n];
    int zg = 0;
    int zd=999;
    int sum = 0;
    for (int i = 0; i < arr.Length; i++)
    {
    Console.WriteLine("请输入第" + (i+ 1) + "个人的成绩");
    arr[i] = int.Parse(Console.ReadLine());

    if (zg < arr[i])
    {
    zg = arr[i];
    }
    if (zd > arr[i])
    {
    zd = arr[i];
    }

    sum +=arr[i];

    }
    double avg=(sum-zg-zd)/(n-2);
    Console.WriteLine("平均分:"+avg);
    Console.WriteLine("最高分为"+zg);
    Console.WriteLine("最低分为"+zd);
    Console.ReadLine();*/


    /* Console.WriteLine("请输入一个数");
    int n = int.Parse(Console.ReadLine());
    int[]arr=new int[n];
    int zg = 0;
    int zd = 999;
    int sum = 0;
    for (int i = 0; i < arr.Length ; i++)
    {
    Console.WriteLine("请输入第"+(i+1)+"个人的成绩");
    arr[i] = int.Parse(Console.ReadLine());
    if(zg<arr[i])
    {
    zg=arr[i];
    }
    if(zd>arr[i])
    {
    zd=arr[i];
    }
    sum+=arr[i];
    }
    double avg=(sum-zg-zd)/(n-2);
    Console.WriteLine("平均值为:"+avg);
    Console.WriteLine("成绩最高"+zg);
    Console.WriteLine("成绩最低"+zd);*/

    /* Console.WriteLine("请输入人数");
    int n = int.Parse(Console.ReadLine());
    int[] arr = new int[n];
    for (int i = 0; i < arr.Length; i++)
    {
    Console.WriteLine("请输入第" + (i + 1) + "个人的成绩");
    arr[i] = int.Parse(Console.ReadLine());
    }
    for (int j = 0; j < arr.Length-1 ; j++)
    {
    for (int i = j+1; i <arr.Length; i++)
    {
    if (arr[j] < arr[i])
    {
    int z = arr[i];
    arr[i] = arr[j];
    arr[j] = z;
    }
    }
    }
    for (int i = 0; i <arr.Length ; i++)
    {
    Console.WriteLine(arr[i]+" ");
    }
    Console.ReadLine();*/

    /* Console.WriteLine("请输入一个数");
    int n = int.Parse(Console.ReadLine());


    int[] arr = new int[n];
    for (int i = 0; i <arr.Length ; i++)
    {
    Console.WriteLine("请输入第"+(i+1)+"的身高");
    arr[i]=int.Parse(Console.ReadLine());//直接用arr[i]赋值即可,arr[i]前面不用加int
    }
    for (int j = 0; j <arr.Length-1; j++)
    {
    for (int i =j+1; i < arr.Length; i++)
    {
    if(arr[j]<arr[i])
    {
    int z = arr[i];
    arr[i] =arr[j];
    arr[j]=z;
    }
    }
    }
    for (int i = 0; i < arr.Length; i++)
    {
    Console.WriteLine(arr[i] + " ");
    }
    Console.ReadLine();*/


    /* Console.WriteLine("请输入手机号数量");
    int n = int.Parse(Console.ReadLine());
    string[] arr = new string[n];
    for (int i = 0; i < arr.Length; i++)
    {
    Console.WriteLine("请输入第" + (i + 1) + "手机号");
    arr[i] = Console.ReadLine();
    Console.Clear();//清屏
    }
    Console.WriteLine("请输入Y/N,确定是否随机");
    string m = Console.ReadLine();
    if (m == "Y" || m == "y")
    {
    for (int j = 0; j < 3; j++)
    {
    for (int i = 0; i < n; i++)
    {
    Console.WriteLine(arr[i]);
    Thread.Sleep(100);
    Console.Clear();
    }

    }
    Random r = new Random();
    int index = r.Next(0, n);
    Console.WriteLine(arr[index]);
    Console.WriteLine("恭喜中奖的号码为" + arr[index] + "的机主");
    }
    else
    {
    Console.WriteLine("未进行随机");
    }
    Console.ReadLine();*/


    // 二维数组
    /* int[] sz = new int[3] { 3, 5, 7 };
    int [,]arr=new int [2,3]{
    {1,3,5};
    {2,4,6};
    }
    arr[1,1]=15;
    foreach (int a in arr)
    {
    Console.WriteLine(a);
    }
    for (int i = 0; i < 2; i++)
    {
    for (int j = 0; j < 3; j++)
    {
    Console.WriteLine(arr[i,j]+" ");
    }
    Console.WriteLine("");
    }*/

  • 相关阅读:
    excel转换为dta格式
    移动pdf
    豆瓣爬虫
    python给证件照换底色
    OS模块
    决策树参数
    Pandas数据连接
    Sklearn用法
    numpy.loadtxt()用法
    单片机基础(五):定时/计数器的工作原理及工作方式
  • 原文地址:https://www.cnblogs.com/yg6405816/p/5343435.html
Copyright © 2020-2023  润新知