linux系统及编程基础课后答案

firstNum -= secondNum;break; case Qt::Key_Asterisk: firstNum *= secondNum;break; case Qt::Key_Slash:

firstNum /= secondNum;break; default:

firstNum = firstNum; }

edit->setText(QString::number(firstNum)); }

void CWidget::setValue() {

QString tempStr; tempStr = edit->text();

if(tempStr.length() < edit->maxLength()) tempStr += ((QPushButton *)sender())->text(); else {

QMessageBox::information( this, tr(\ }

if(-1==oper) {

firstNum = tempStr.toInt();

edit->setText(QString::number(firstNum)); } else {

secondNum = tempStr.toInt();

edit->setText(QString::number(secondNum)); } }

void CWidget::setOper() {

QString str=((QPushButton *)sender())->text(); if(str == \

onClicked(Qt::Key_Plus); else if(str == \

onClicked(Qt::Key_Minus); else if(str == \

onClicked(Qt::Key_Asterisk); else if(str == \

onClicked(Qt::Key_Slash); else if(str == \ calculate(); }

void CWidget::clear() {

edit->clear();

edit->setText(tr(\ initialize(); }

void CWidget::initialize() {

firstNum = 0; secondNum = 0; oper = -1; }

void CWidget::createForm() {

setMinimumSize(80,200); setMaximumSize(80,200);

mainLayout = new QVBoxLayout(this,20); topLayout = new QHBoxLayout(mainLayout,30); edit = new QLineEdit(this,\ edit->setAlignment(Qt::AlignRight); edit->setMaxLength(9); edit->setText(tr(\ edit->setReadOnly(true); topLayout->addWidget(edit);

bottomLayout = new QGridLayout(mainLayout,4,4,10); int n;

for(int r=0; r<3; r++) for(int c=0; c<3; c++) {

n = c+3*r;

but

>>闂傚倸鍊搁崐鎼佸磹瀹勬噴褰掑炊椤掑鏅悷婊冪箻楠炴垿濮€閵堝懐顔婂┑掳鍊愰崑鎾剁棯閹岀吋闁哄矉缍侀獮鍥敍閿濆棌鎸呮繝鐢靛仜濡﹥绂嶅⿰鍫濈闁逞屽墮椤啴濡堕崱妤€衼缂傚倸绉村Λ妤€鐜婚崸妤佸亜闁稿繐鐨烽幏铏圭磼缂併垹骞栭柟鍐茬箺閵囨劘顦寸紒杈ㄥ浮閹晠宕橀懠顑挎偅缂傚倷绶¢崰鏍偋閹惧磭鏆﹂柟鐑橆殕閸婄兘鎮楅悽鐧诲湱鏁幆褉鏀介柣妯虹仛閺嗏晛鈹戦纰卞殶闁瑰箍鍨硅灒濞撴凹鍨抽埀顒冨煐閵囧嫰寮村Δ鈧禍楣冩⒑閸濆嫮鐒跨紒鏌ョ畺楠炲棝寮崼顐f櫖濠电偞鍨堕敃鈺傚閿燂拷<<
12@gma联系客服:779662525#qq.com(#替换为@)