I am new to QT Creator and my knowledge of C++ is still beginner so I am running into some issues. I am trying to make a program that calculates a formula about bacteria growth. I am trying to type the equivalent of "e^kt"(k and t being variables that are part of the whole formula) and I cant seem to get it to work. To try and find out how to type the equivalent of "e" I found some instruction on http://qt-project.org/doc/qt-4.8/qtcore-qmath-h.html and am trying to follow the instructions. Here is part of my code in my mainwindow.cpp:
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <string>
#include <qmath.h>
....
void MainWindow::on_btnCalculate_clicked()
{
QString s;
int intNum1 = ui->leNum1->text().toInt();
int intNum2 = ui->leNum2->text().toInt();
int intNum3 = qreal qExp (qreal intNum1* intNum2);
s = s.number(intNum3);
ui->lblCalculate->setText(s);
}
With any other math operation I have been able to figure it out but I keep getting an error message saying: "expected primary-expression before 'qExp' int intNum3 = qreal qExp (qrael intNum1 * intNum2);". If anyone can help identify what Im doing wrong or perhaps can propose another way it would be greatly appreciated.
void MainWindow::on_btnCalculate_clicked()
{
QString s;
int intNum1 = ui->leNum1->text().toInt();
int intNum2 = ui->leNum2->text().toInt();
qreal result = qExp((qreal)intNum1* intNum2);
s = QStrimg::number(result);
ui->lblCalculate->setText(s);
}