这些天我正在学习QT,我想测试做while循环,实际登录正常工作,但在QT中应用程序冻结..我在头文件(公共)中定义了randnum和猜测
void MainWindow::on_pushButton_clicked()
{
srand (time(NULL));
randnum = rand() % 10 +1;
do {
guess = ui->spinBox->value();
if (guess < randnum)
{
ui->label->setText("try something big");
}
else if (guess > randnum)
{
ui->label->setText("try something small");
}
else
ui->label->setText("YAY?");
} while (guess != randnum);
}
请告诉我如何找到它冻结的原因..谢谢!