C++ cli 如何在程序运行的do while循环中设置条件
我面临着这个问题,我试图解决它,但我无法满足我需要你的帮助。。这是我的代码:C++ cli 如何在程序运行的do while循环中设置条件,c++-cli,C++ Cli,我面临着这个问题,我试图解决它,但我无法满足我需要你的帮助。。这是我的代码: #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::ToDoub
#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循环工作的条件。我不是100%确定你在问什么,但我认为问题是你在UI线程上停留在while循环中 相反,让按钮处理程序启动a、a或类似的东西,并在那里执行工作
如果TurnCurLink方法进行UI访问,请务必返回到UI线程。
C++的Windows应用程序窗体