Programmers, help!
using system;
Using System.Collections.Genic;
Using System.comPonentModel;
Using System.Data;
Using System.Drawing;
Using System.Linq;
Using System.Text;
using system.threading.tasks;
using System.Windows.Forms;
Namespace learnenglish
{
Public Partial Class Start: Form
{
Public String [] WordsandTranslate = New String [] {};
Public int [] oddnumbers = new int [] {};
Public int [] evennumbers = New int [] {};
Public int Count = 0;
Public int buttonClick = 0;
Public Start ()
{
Initializecomponent ();
}
Private Void Label1_Click (Object Sender, Eventargs E)
{
}
Private Void Start_Load (Object Sender, Eventargs E)
{
Words Words = New Words ();
String Text = Words.get ();
String [] SplitText = Text.Split (',');
While (True)
{
If (Count == SplitText.Length)
{
Break;
}
WordSandTranslate = SplitText [Count] .split ('-');
COUNT ++;
}
label1.text = WordsandTranslate [0];
Int Countofletter = WordsandTranslate.Length;
INT COUNTOFFORFIRST = 0;
INT COUNTOFFORSECOND = 0;
For (int i = 1; i & lt; = WordsandTranslate.Length; i + = 2)
{
Oddnumbers [Countofforfirst] = i;
Countofforfirst ++;
}
For (int y = 0; y & lt; = WordsandTranslate.Length; Y + = 2)
{
Evennumbers [CountofforSecond] = y;
CountofForSecond ++;
}
}
Private Void Button1_Click (Object Sender, Eventargs E)
{
if (textbox1.text == WordsandTranslate [Evennumbers [ButtonClick]]) {
label1.text = WordsandTranslate [ODDNUMBERS [ButtonClick]];
}
}
}
}
Problem:
for (int i = 1; i & lt; = wordsandtranslate.length; i + = 2)
{
Oddnumbers [Countofforfirst] = i;
Countofforfirst ++;
}
Answer 1, Authority 100%
Helping:
Array ODDNUMBERS
Not the size you need.
oddnumbers = new int [Wordsandtranslate.length / 2 + WordsandTranslate.Length% 2];
For (int i = 1; i & lt; = WordsandTranslate.Length; i + = 2)
{
...