OK我試圖去通過代碼自己一堆次,但在人們的首選的Visual Studio總是說這是錯的..索引越界 - C#
指數成分股必然會錯誤
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
//declare Arrays for buttons and
//LEDs
int[] buttonArray = new int[4]; // Left to right .-.. ------
//left, top, bottom, right
int[,] ledArray = new int[10, 10];
//declare variables
int strandSnake = 0;
int requestR = 0;
int countDeclareButtonArray = 0;
int countWriteButtonArray = 0;
//code
if (strandSnake != 1)
{
}
//Declaring the four buttons
for (int ip = 0; ip < 4; ip++)
{
buttonArray[countDeclareButtonArray] = countDeclareButtonArray;
countDeclareButtonArray++;
}
// writing the four buttons to the screen.
foreach (int ip in buttonArray)
{
requestR = buttonArray[countWriteButtonArray];
countWriteButtonArray++;
}
Console.ReadLine();
}
}
}
請格式化您的代碼並提供更多信息。哪一行產生錯誤?你能把整個信息粘貼在這裏嗎? – gustavotkg
錯誤發生在哪裏? – BWC
「錯」是什麼意思? – JAM