当前位置:网站首页>Experiment 4 QT
Experiment 4 QT
2022-06-30 08:02:00 【emplace_ back】
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_get_ans_clicked()
{
ui->m_ans->setText("");
if(ui->m_x->text().isEmpty()||ui->m_y->text().isEmpty()) return ;
bool ok=false;
int x=ui->m_x->text().toInt(&ok);
if(!ok) {
ui->m_x->setText("");
return ;
}
ok=false;
int y=ui->m_y->text().toInt(&ok);
if(!ok) {
ui->m_y->setText("");
return ;
}
QString op=ui->m_op->text();
if(op=="+") {
ui->m_ans->setText(QString::number(x+y));
} else if(op=="-") {
ui->m_ans->setText(QString::number(x-y));
} else if(op=="*") {
ui->m_ans->setText(QString::number(x*y));
} else if(op=="/") {
if(y==0) ui->m_ans->setText("diverror");
else ui->m_ans->setText(QString::number(x/y));
} else if(op=="^") {
int ans=1;
for(int i=0;i<y;i++) ans*=x;
ui->m_ans->setText(QString::number(ans));
} else if(op=="%") {
ui->m_ans->setText(QString::number(x%y));
} else {
ui->m_ans->setText("ERROR");
}
return ;
}
void MainWindow::on_exit_clicked()
{
close();
return ;
}
边栏推荐
- 深度学习——Bounding Box预测
- Self study notes -- use of 74h573
- Final review -php learning notes 2-php language foundation
- December 4, 2021 - Introduction to macro genome analysis process tools
- 【Tensorflow-gpu】window11下深度学习环境搭建
- Intersection of two lines
- 深度学习——网络中的网络以及1x1卷积
- How to handle the expired data of redis and what are the elimination mechanisms?
- [flower carving experience] 14 line blank board pingpong library test external sensor module (one)
- C. Fishingprince Plays With Array
猜你喜欢

【JUC系列】Fork/Join框架之概览

right four steps of SEIF SLAM
![2021-10-29 [microbiology] a complete set of 16s/its analysis process based on qiime2 tool (Part I)](/img/9d/37c531b1b439770f69f715687685f5.jpg)
2021-10-29 [microbiology] a complete set of 16s/its analysis process based on qiime2 tool (Part I)

深度学习——Bounding Box预测

深度学习——语言模型和序列生成

深度学习——卷积的滑动窗口实现

Lexicographic order -- full arrangement in bell sound

Deep learning - residual networks resnets

为什么大学毕业了还不知道干什么?

Armv8 (coretex-a53) debugging based on openocd and ft2232h
随机推荐
Simple application of generating function
Armv8 (coretex-a53) debugging based on openocd and ft2232h
想转行,却又不知道干什么?此文写给正在迷茫的你
深度学习——循环神经网络
Do you know the IP protocol?
Bingbing learning notes: quick sorting
Deep learning - LSTM
Distance from point to line
Final review -php learning notes 4-php custom functions
AcrelEMS能效管理平台为高层小区用电安全保驾护航
December 19, 2021 [reading notes] - bioinformatics and functional genomics (Chapter 5 advanced database search)
Deep learning -- recurrent neural network
Introduction notes to pytorch deep learning (11) neural network pooling layer
期末复习-PHP学习笔记2-PHP语言基础
Want to ask, how to choose securities companies for stock speculation? Is it safe to open an account online?
Program acceleration
Permutation and combination of probability
2021.11.20 [reading notes] | differential variable splicing events and DTU analysis
Analysis of cross clock transmission in tinyriscv
Deep learning - residual networks resnets