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
 #include "mainwindow.h"
6
 #include "mainwindow.h"
7
 #include "ui_mainwindow.h"
7
 #include "ui_mainwindow.h"
8
 #include <QMessageBox>
8
 #include <QMessageBox>
9
+#include <cmath>
9
 
10
 
10
 MainWindow::MainWindow(QWidget *parent) :
11
 MainWindow::MainWindow(QWidget *parent) :
11
     QMainWindow(parent),
12
     QMainWindow(parent),
49
     delete scene;
50
     delete scene;
50
 }
51
 }
51
 
52
 
53
+
52
 void MainWindow::quadraticFormulaCheck()
54
 void MainWindow::quadraticFormulaCheck()
53
 {
55
 {
54
     // float firstX;
56
     // float firstX;
55
-    float resultFromFunction;
57
+    double resultFromFunction;
56
     bool pass = true;
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
         689 , -689 , 172 , 0.519048482944 , 90 , 521 , 751 , -2.71178575308 , 5 , 107 ,
60
         689 , -689 , 172 , 0.519048482944 , 90 , 521 , 751 , -2.71178575308 , 5 , 107 ,
59
         465 , -6.0642692054 , 1609 , -983 , 150 , 0.314734649792 , 273 , 496 , 224 ,
61
         465 , -6.0642692054 , 1609 , -983 , 150 , 0.314734649792 , 273 , 496 , 224 ,
60
         -0.839700867988 , 2 , 91 , 920 , -15.1630045473 , 48 , 300 , 463 , -2.77889067238 ,
62
         -0.839700867988 , 2 , 91 , 920 , -15.1630045473 , 48 , 300 , 463 , -2.77889067238 ,
61
         852 , 907 , 241 , -0.510947439149};
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
         270 , -904 , 755 , 1.59515823795 , 67 , -450 , 752 , 3.12650485528 , 98 , 506 , 651 ,
66
         270 , -904 , 755 , 1.59515823795 , 67 , -450 , 752 , 3.12650485528 , 98 , 506 , 651 ,
65
         -2.72985550047 , 38 , -373 , 901 , 4.29396930804 , 273 , -282 , 72 , 0.461538461538 ,
67
         -2.72985550047 , 38 , -373 , 901 , 4.29396930804 , 273 , -282 , 72 , 0.461538461538 ,
66
         225 , -889 , 874 , 1.84 , 8 , 136 , 522 , -11.1457513111 , 5 , 77 , 214 , -11.760788100};
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
     //Verifying if the equation written by the student is correct
72
     //Verifying if the equation written by the student is correct
71
     for (int i = 0; i < 40 && pass; i+=4){
73
     for (int i = 0; i < 40 && pass; i+=4){
76
 
78
 
77
         resultFromFunction = frogger->QuadraticPlus(a,b,c);
79
         resultFromFunction = frogger->QuadraticPlus(a,b,c);
78
 
80
 
79
-        if( abs(resultFromFunction - expected) > 0.00001) {
81
+        if( fabs(resultFromFunction - expected) > 0.00001) {
80
             pass = false;
82
             pass = false;
81
         }
83
         }
82
     }
84
     }
94
 
96
 
95
         resultFromFunction = frogger->QuadraticMinus(a,b,c);
97
         resultFromFunction = frogger->QuadraticMinus(a,b,c);
96
 
98
 
97
-        if( abs(resultFromFunction - expected) > 0.00001) {
99
+        if( fabs(resultFromFunction - expected) > 0.00001) {
98
             pass = false;
100
             pass = false;
99
         }
101
         }
100
     }
102
     }
158
     frogger->reset();
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
     if(ui->alineEdit->text() != "" && ui->blineEdit->text() != "" && ui->clineEdit->text() != "" ){
165
     if(ui->alineEdit->text() != "" && ui->blineEdit->text() != "" && ui->clineEdit->text() != "" ){
164
         ui->RunPushButton->setEnabled(true);
166
         ui->RunPushButton->setEnabled(true);
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
     if(ui->alineEdit->text() != "" && ui->blineEdit->text() != "" && ui->clineEdit->text() != "" ){
175
     if(ui->alineEdit->text() != "" && ui->blineEdit->text() != "" && ui->clineEdit->text() != "" ){
174
         ui->RunPushButton->setEnabled(true);
176
         ui->RunPushButton->setEnabled(true);
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
     if(ui->alineEdit->text() != "" && ui->blineEdit->text() != "" && ui->clineEdit->text() != "" ){
185
     if(ui->alineEdit->text() != "" && ui->blineEdit->text() != "" && ui->clineEdit->text() != "" ){
186
         ui->RunPushButton->setEnabled(true);
186
         ui->RunPushButton->setEnabled(true);