C# 数组元素查找

来源:互联网 发布:金十数据手机客户端 编辑:程序博客网 时间:2024/06/03 01:42
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace ConsoleApplication2{    static class FindArray    {        public static void find <T> ( ref T []A,ref int n)        {            Console.WriteLine("数组中第{0}个元素为{1}", n , A[n - 1]);        }    }    class Program    {        static void Main(string[] args)        {            double [] A = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };            Console.WriteLine("请输入要查找的元素的位置");            int n=int.Parse(Console.ReadLine());            FindArray.find<double>(ref A, ref n);            Console.ReadKey();        }    }}


 

 

运行结果;

 

   

0 0
原创粉丝点击