public int lat()
{
int[] array = new int[] { 9, 2, 5, 4, 14, 6, 9, 7, 8, 5, 6 };
int temp = 0;
int index = 0;
for (int i = 0; i < array.Length; i++)
{
if (temp < array[i]) //如果用<= 则找到的是最大值(多个中的最后一个) <则是多个中的第一个
{
temp = array[i];
index = i;
}
List<int> list = new List<int>();
for (int x = 0; x < array.Length; i++)
{
if (array[x] + 3 > array[index])
list.Add(int.Parse(currentline)); ;
}
int[] result = list.ToArray();
return list;
}
红色部分所在函数,应该返回int,你却返回List<int>
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Collections;
namespace WindowsFormsApplication6
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public int getnumber()
{
int[] array = new int[] { 9, 2, 5, 4, 14, 6, 9, 7, 8, 5, 6 };
int temp = 0;
int index = 0;
for (int i = 0; i < array.Length; i++)
{
if (temp < array[i]) //如果用<= 则找到的是最大值(多个中的最后一个) <则是多个中的第一个
{
temp = array[i];
index = i;
}
}
return index;
}
private void button1_Click_1(object sender, EventArgs e)
{
textBox1.Text = getnumber().ToString();
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
public int lat()
{
int[] array = new int[] { 9, 2, 5, 4, 14, 6, 9, 7, 8, 5, 6 };
int temp = 0;
int index = 0;
for (int i = 0; i < array.Length; i++)
{
if (temp < array[i]) //如果用<= 则找到的是最大值(多个中的最后一个) <则是多个中的第一个
{
temp = array[i];
index = i;
}
List<int> list = new List<int>();
for (int x = 0; x < array.Length; i++)
{
if (array[x] + 3 > array[index])
list.Add(int.Parse(currentline)); ;
}
int[] result = list.ToArray();
return list;
}
}
}
}