gpt4 book ai didi

c++ - QT中使用C++制作对象的基本疑问

转载 作者:行者123 更新时间:2023-11-27 22:31:56 25 4
gpt4 key购买 nike

int main (int argc, char* argv[]) 
{
QApplication app(argc, argv);
QTextStream cout(stdout, QIODevice::WriteOnly);

// Declarations of variables
int answer = 0;

do {
// local variables to the loop:
int factArg = 0;
int fact(1);
factArg = QInputDialog::getInteger(0, "Factorial Calculator",
"Factorial of:", 1);
cout << "User entered: " << factArg << endl;
int i=2;
while (i <= factArg) {
fact = fact * i;
++i;
}
QString response = QString("The factorial of %1 is %2.\n%3")
.arg(factArg).arg(fact)
.arg("Do you want to compute another factorial?");
answer = QMessageBox::question(0, "Play again?", response,
QMessageBox::Yes | QMessageBox::No);
} while (answer == QMessageBox::Yes);
return EXIT_SUCCESS;
}

Link taken from here最初来自上面的链接...

你能帮我解决“QInputDialog..(do while 循环的第 4 行)”我如何知道它有哪些参数?我看到了文档,但我找不到参数中的“0”和“1”是什么..

最佳答案

Read the docs .基本上 - first 是父小部件(在本例中为 NULL),标签后的 1 是默认值。

关于c++ - QT中使用C++制作对象的基本疑问,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1412885/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com