delete pics to save space
This commit is contained in:
30
history_source/信息学奥赛一本通/2.4.1.cpp
Normal file
30
history_source/信息学奥赛一本通/2.4.1.cpp
Normal file
@ -0,0 +1,30 @@
|
||||
#include<iostream>
|
||||
#include<string>
|
||||
#include<math.h>
|
||||
using namespace std;
|
||||
bool isop(string n)
|
||||
{
|
||||
if(n=="+") return 1;
|
||||
if(n=="-") return 1;
|
||||
if(n=="*") return 1;
|
||||
if(n=="/") return 1;
|
||||
return 0;
|
||||
}
|
||||
double operation()
|
||||
{
|
||||
string sr;
|
||||
cin>>sr;
|
||||
if(!isop(sr)) return atof(sr.c_str());
|
||||
switch(sr[0])
|
||||
{
|
||||
case '+': return operation()+operation();
|
||||
case '-': return operation()-operation();
|
||||
case '*': return operation()*operation();
|
||||
case '/': return operation()/operation();
|
||||
}
|
||||
}
|
||||
int main()
|
||||
{
|
||||
printf("%.6lf\n",operation());
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user