using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;namespace test1
{
class Program
{
static void Main(string[] args)
{ static int Find(int value, int[] array)
{
int i = 0;
while (array[i] != value)
{
if (++i > array.Length)
Console.Write("Can not find");
}
return i;
}
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;namespace test1
{
class Program
{
static void Main(string[] args)
{ static int Find(int value, int[] array)
{
int i = 0;
while (array[i] != value)
{
if (++i > array.Length)
Console.Write("Can not find");
}
return i;
}
}
}
}
解决方案 »
- 关于如何修改会员上传的图片的名称,不会有相同的图片名称而被覆盖
- DetailsView1的问题
- 应届生去软件公司一个小问题,急急急急急急急急
- 权限问题
- 对我来说的超难问题(有关session),送分喽!
- 谁能解释一下<%# %>,<%$ %>,<%@ %>,>,<%= %>的用法?
- 怎么样能避免一些非浏览器(如离线下载或C/S软件)的恶意抓取
- 技术探讨:有无可能在ASP.net应用程序中建立一个长期运行的Socket服务端
- 紧急求救!!!SOS(数据库连接)
- asp.net core2.0 中在如何在类文件中获取appsetting.json的数据库连接字符串
- DGI+ 一般性错误 image.save() 急!!!
- 分不多,求一个方法。谢谢
using System.Collections.Generic;
using System.Text;namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int[] array = new int[5] { 1,2,3,4,5}; int index =Find(5, array);
if ( index < 0)
{
Console.Write("Can not find");
}
else
{
Console.Write(index);
}
} private static int Find(int value, int[] array)
{
int i = 0;
while (array[i] != value)
{
if (++i > array.Length)
return -1;
}
return i;
}
}
}