C#include "proekt1.h"#include <QApplication> float a0,b0,result1;int main(int argc, char *argv[]){ result1=a0+b0; QApplication a(argc, argv); Proekt1 w; w.show(); return a.exec();}
C#include "proekt1.h"#include "ui_proekt1.h" Proekt1::Proekt1(QWidget *parent) : QMainWindow(parent), ui(new Ui::Proekt1){ ui->setupUi(this);} Proekt1::~Proekt1(){ delete ui;}void Proekt1::on_pushButton_clicked(){ extern float a0,b0,result1; a0=ui->lineedit->text().toFloat(); b0=ui->lineedit2->text().toFloat(); ui->textedit->setText(QString::number(result1));}
C++ (Qt)void Proekt1::on_pushButton_clicked(){ float a0 = ui->lineedit->text().toFloat(); float b0 = ui->lineedit2->text().toFloat(); ui->textedit->setText(QString::number(a0 + b0));}
C Proekt1::Proekt1(QWidget *parent, float a0, float b0, float result1) : QMainWindow(parent), ui(new Ui::Proekt1){ ui->setupUi(this);}
Cmain.cpp #include "proekt1.h"#include <QApplication>float a0,b0,result1; int main(int argc, char *argv[]){ QApplication a(argc, argv); Proekt1 w; w.show(); a0=0; b0=0; result1=0; result1=a0+b0; return a.exec();}