2013年7月5日
摘要: 这里要比较的是两个数组中的内容是否相同,以int数组为例int[] Arraya=new[] {1,2,3,4,5}int[] Arrayb=new[] {5,3,2,1,4}以上两个数组内的值是相同的,都是1,2,3,4,5.具体的算法如下。第一种就是最原始的方法,使用循环。public static bool compareArr(int[] arr1,int[] arr2){bool[] flag=new bool[arr1.Length];//初始化一个bool数组,初始值全为false;for(int i=0;i<arr1.Length;i++){for(int j=0;j&l 阅读全文
posted @ 2013-07-05 10:30 halia 阅读(16442) 评论(0) 推荐(0) 编辑