I want to convert the Qstring in the QLineEdit to double using QList so that it could perform a calculation and display the results in the QMessagebox. If I can get some suggestions on how this can be done it would be great.
#include <QtGui>
#include <QList>
#include <iostream>
int main (int argc, char* argv[])
{
QApplication app(argc, argv);
QTextStream cout(stdout);
bool ok;
double answer;
do
{
QString mark = QInputDialog::getText(NULL ,"MarkCalc","Enter Mark:", QLineEdit::Normal,"", &ok);
if (ok && !mark.isEmpty())
QList <QString> list;
double am = (mark * 0.20)+(mark * 0.50)+(mark * 0.30);
double ym = am * 0.20;
double em = 75 * 0.40;
double fm = em + ym;
if (em <= 40 && fm >= 50)
cout <<"pass";
else
cout << "fail";
QString response = QString("Your Final Mark: %1 \n\n%5").arg(ym).arg(em);
answer = QMessageBox::question(0, "Final Marks", response,QMessageBox::Yes | QMessageBox::No);
} while (answer == QMessageBox::Yes);
return 0;
}