我遇到了这个问题而且我试图解决它,但我无法取悦我需要你的帮助..这是我的代码:
#pragma endregion
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
y=Convert::ToInt16(textBox1->Text);
c=Convert::ToInt16(textBox3->Text);
a=Convert::ToDouble(rand() % y);
b=Convert::ToDouble(rand() % c);
textBox2->Text = Convert::ToString(a);
textBox4->Text = Convert::ToString(b);
x1=0;
x2=0;
do
{
trafficlight(a,b,1,2);
}while(i==0);//here is my problem i need condition to make the while loop working while the program is running
如果我单击按钮它只跳转到while循环而没有前面的代码,我需要先前的代码才能工作,并且条件使得while循环在程序运行时工作..