Browse Source

mainwindow.cpp - changes to avoid warnings

Rafael Arce Nazario 9 years ago
parent
commit
b755128b1f
1 changed files with 11 additions and 11 deletions
  1. 11
    11
      mainwindow.cpp

+ 11
- 11
mainwindow.cpp View File

@@ -6,6 +6,7 @@
6 6
 #include "mainwindow.h"
7 7
 #include "ui_mainwindow.h"
8 8
 #include <QMessageBox>
9
+#include <cmath>
9 10
 
10 11
 MainWindow::MainWindow(QWidget *parent) :
11 12
     QMainWindow(parent),
@@ -49,23 +50,24 @@ MainWindow::~MainWindow()
49 50
     delete scene;
50 51
 }
51 52
 
53
+
52 54
 void MainWindow::quadraticFormulaCheck()
53 55
 {
54 56
     // float firstX;
55
-    float resultFromFunction;
57
+    double resultFromFunction;
56 58
     bool pass = true;
57
-    float values[] = {357 , -1000 , 698 , 1.4804781099 , 748 , -392 , 51 , 0.28391805554 ,
59
+    double values[] = {357 , -1000 , 698 , 1.4804781099 , 748 , -392 , 51 , 0.28391805554 ,
58 60
         689 , -689 , 172 , 0.519048482944 , 90 , 521 , 751 , -2.71178575308 , 5 , 107 ,
59 61
         465 , -6.0642692054 , 1609 , -983 , 150 , 0.314734649792 , 273 , 496 , 224 ,
60 62
         -0.839700867988 , 2 , 91 , 920 , -15.1630045473 , 48 , 300 , 463 , -2.77889067238 ,
61 63
         852 , 907 , 241 , -0.510947439149};
62 64
 
63
-    float valuesForMinus[] = {129 , -486 , 456 , 1.76744186047 , 384 , 980 , 625 , -1.30208333333 ,
65
+    double valuesForMinus[] = {129 , -486 , 456 , 1.76744186047 , 384 , 980 , 625 , -1.30208333333 ,
64 66
         270 , -904 , 755 , 1.59515823795 , 67 , -450 , 752 , 3.12650485528 , 98 , 506 , 651 ,
65 67
         -2.72985550047 , 38 , -373 , 901 , 4.29396930804 , 273 , -282 , 72 , 0.461538461538 ,
66 68
         225 , -889 , 874 , 1.84 , 8 , 136 , 522 , -11.1457513111 , 5 , 77 , 214 , -11.760788100};
67 69
 
68
-    float a, b, c, expected;
70
+    double a, b, c, expected;
69 71
 
70 72
     //Verifying if the equation written by the student is correct
71 73
     for (int i = 0; i < 40 && pass; i+=4){
@@ -76,7 +78,7 @@ void MainWindow::quadraticFormulaCheck()
76 78
 
77 79
         resultFromFunction = frogger->QuadraticPlus(a,b,c);
78 80
 
79
-        if( abs(resultFromFunction - expected) > 0.00001) {
81
+        if( fabs(resultFromFunction - expected) > 0.00001) {
80 82
             pass = false;
81 83
         }
82 84
     }
@@ -94,7 +96,7 @@ void MainWindow::quadraticFormulaCheck()
94 96
 
95 97
         resultFromFunction = frogger->QuadraticMinus(a,b,c);
96 98
 
97
-        if( abs(resultFromFunction - expected) > 0.00001) {
99
+        if( fabs(resultFromFunction - expected) > 0.00001) {
98 100
             pass = false;
99 101
         }
100 102
     }
@@ -158,7 +160,7 @@ void MainWindow::on_retryButton_clicked()
158 160
     frogger->reset();
159 161
 }
160 162
 
161
-void MainWindow::on_alineEdit_textChanged(const QString &arg1)
163
+void MainWindow::on_alineEdit_textChanged(const QString &)
162 164
 {
163 165
     if(ui->alineEdit->text() != "" && ui->blineEdit->text() != "" && ui->clineEdit->text() != "" ){
164 166
         ui->RunPushButton->setEnabled(true);
@@ -168,7 +170,7 @@ void MainWindow::on_alineEdit_textChanged(const QString &arg1)
168 170
     }
169 171
 }
170 172
 
171
-void MainWindow::on_blineEdit_textChanged(const QString &arg1)
173
+void MainWindow::on_blineEdit_textChanged(const QString &)
172 174
 {
173 175
     if(ui->alineEdit->text() != "" && ui->blineEdit->text() != "" && ui->clineEdit->text() != "" ){
174 176
         ui->RunPushButton->setEnabled(true);
@@ -178,9 +180,7 @@ void MainWindow::on_blineEdit_textChanged(const QString &arg1)
178 180
     }
179 181
 }
180 182
 
181
-
182
-
183
-void MainWindow::on_clineEdit_textChanged(const QString &arg1)
183
+void MainWindow::on_clineEdit_textChanged(const QString &)
184 184
 {
185 185
     if(ui->alineEdit->text() != "" && ui->blineEdit->text() != "" && ui->clineEdit->text() != "" ){
186 186
         ui->RunPushButton->setEnabled(true);