Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "mainwindow.h"
- #include "ui_mainwindow.h"
- #include <QDebug>
- #include <math.h>
- MainWindow::MainWindow(QWidget *parent) :
- QMainWindow(parent),
- ui(new Ui::MainWindow)
- {
- ui->setupUi(this);
- }
- MainWindow::~MainWindow()
- {
- delete ui;
- }
- void MainWindow::on_pushButton_2_clicked()
- {
- exit(0);
- }
- void MainWindow::on_pushButton_clicked()
- {
- int row = ui->lineEdit->text().toInt();
- int column = ui->lineEdit_2->text().toInt();
- //MAIN ELEMENT CALCULATION work!
- ui->tableWidgetResult->item(row,column)->setText(QString::number((
- pow((ui->tableWidget->item(row,column)->text().toDouble()),-1))));
- //MAIN COLUMN CALCULATION work!
- int iN=0;
- while (iN<6) {
- if (iN!=row) {
- ui->tableWidgetResult->item(iN,column)->setText(QString::number(
- pow(((ui->tableWidget->item(iN,column)->text().toDouble())*(-1)),-1)));
- }
- iN++;
- }
- //MAIN ROW CALCULATION work!
- int jN=0;
- while (jN<5) {
- if (jN!=column) {
- ui->tableWidgetResult->item(row,jN)->setText(QString::number(
- pow((ui->tableWidget->item(column,jN)->text().toDouble()),-1)));
- }
- jN++;
- }
- //OTHER ELEMENTS work!
- int iM;
- int jM;
- for (iM=0; iM<6; iM++) { //row
- for (jM=0; jM<5; jM++) { //columns
- if (iM!=row && jM!=column) {
- ui->tableWidgetResult->item(iM,jM)->setText(QString::number(
- ( (ui->tableWidget->item(iM,jM)->text().toDouble()) -
- ((ui->tableWidget->item(iM,column)->text().toDouble()) *
- (ui->tableWidget->item(row,jM)->text().toDouble()) /
- (ui->tableWidget->item(row,column)->text().toDouble())) ) ) );
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement