Skip to content

Commit

Permalink
小修复
Browse files Browse the repository at this point in the history
  • Loading branch information
andywowws committed Jul 13, 2023
1 parent 8850bab commit a912573
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions calculator/calcer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,11 @@ void calcer::pushe(){
if(s=="0")s="";
if(!s.isEmpty()){
QChar a=s.back();
bool x=0;
if(a=='='){s.erase(s.end()-1);x=1;}
a=s.back();
if(!a.isDigit())s+="2.7182818284590452353602874713527";
else if(x)s+='=';
}else s="2.7182818284590452353602874713527";
ui->textEdit->setText(s);
return;
Expand All @@ -101,7 +105,11 @@ void calcer::pushpi(){
if(s=="0")s="";
if(!s.isEmpty()){
QChar a=s.back();
bool x=0;
if(a=='='){s.erase(s.end()-1);x=1;}
a=s.back();
if(!a.isDigit())s+="3.1415926535897932384626433832795";
else if(x)s+='=';
}else s="3.1415926535897932384626433832795";
ui->textEdit->setText(s);
return;
Expand Down

0 comments on commit a912573

Please sign in to comment.