[讨论][求助]VS.NET2003寫的小遊戲 有問題
private: System::Void button1_Click(System::Object * sender, System::EventArgs * e){
a = num->Next(0,10);
b = num->Next(0,10);
c = num->Next(0,10);
d = num->Next(0,10);
if(a!=b && a!=c && a!=d && b!=c && b!=d && c!=d)
richTextBox1->Text=String::Concat(listBox1->Text,S"",a.ToString("0"),S" ",b.ToString("0"),S" ",c.ToString("0"),S" ",d.ToString("0"),S" ",S"\r\n");
}
private: System::Void button2_Click(System::Object * sender, System::EventArgs * e)
{
int ao=0,bo=0,count
for(count=0;count++;count<=7)
listBox1->Items->Add(textBox1->Text);
listBox2->Items->Add(textBox2->Text);
listBox3->Items->Add(textBox3->Text);
listBox4->Items->Add(textBox4->Text);
h=Int32:arse(textBox1->Text);
i=Int32:arse(textBox2->Text);
j=Int32:arse(textBox3->Text);
k=Int32::Parse(textBox4->Text);
if (textBox1->TextLength>0 && textBox2->TextLength>0 && textBox3->TextLength>0 && textBox4->TextLength>0)
if(a==h)
ao=ao+1;
else if(b==i)
ao=ao+1;
else if(c==j)
ao=ao+1;
else if(d==k)
ao=ao+1;
if(a==i)
bo=bo+1;
else if(a==j)
bo=bo+1;
else if(a==k)
bo=bo+1;
else if(b==h)
bo=bo+1;
else if(b==j)
bo=bo+1;
else if(b==k)
bo=bo+1;
else if(c==h)
bo=bo+1;
else if(c==i)
bo=bo+1;
else if(c==k)
bo=bo+1;
else if(d==h)
bo=bo+1;
else if(d==i)
bo=bo+1;
else if(d==j)
bo=bo+1;
if(ao==0)
listBox5->Items->Add(S"0A");
else if(ao==1)
listBox5->Items->Add(S"1A");
else if(ao==2)
listBox5->Items->Add(S"2A");
else if(ao==3)
listBox5->Items->Add(S"3A");
else if(ao==4)
listBox5->Items->Add(S"4A");
label6->Text=S"恭喜!!!你贏了!!!";
label6->BackColor=Color::Red;
if(bo==0)
listBox6->Items->Add(S"0B");
else if(bo==1)
listBox6->Items->Add(S"1B");
else if(bo==2)
listBox6->Items->Add(S"2B");
else if(bo==3)
listBox6->Items->Add(S"3B");
else if(bo==4)
listBox6->Items->Add(S"4B");
}
private: System::Void button3_Click(System::Object * sender, System::EventArgs * e)
{
count=0;
listBox1->Items->Clear();
listBox2->Items->Clear();
listBox3->Items->Clear();
listBox4->Items->Clear();
listBox5->Items->Clear();
listBox6->Items->Clear();
label6->Text=S" ";
label6->BackColor=Color::DarkKhaki;
}
};
}
寫出來後判斷幾A幾B的方式怪怪的 而且XAXB還會壘加越家越多 = =
麻煩各位幫我看看錯在哪裡??感謝~~