شك الأساسية في QT باستخدام C ++ عن صنع الأشياء
سؤال
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;
}
رابط مأخوذة من هنا أصلا من الرابط أعلاه ...
هل يمكنك مساعدتي للخروج مع "QInputDialog .. (خط 4th من لم بينما حلقة)" كيف يمكنني الحصول على معرفة والحجج لا توجد لديها؟ رأيت وثائق ولكن لم أستطع معرفة ما هذا "0" و "1" في الحجج ..
المحلول
قراءة مستندات . في الأساس - لأول مرة هي القطعة الأم (NULL في هذه الحالة)، و1 بعد التسمية هو القيمة الافتراضية
لا تنتمي إلى StackOverflow