#include<algorithm>
#include<cmath>
(资料图片)
#include<cstdio>
#include<iostream>
using namespace std;
int main(){
float a,b;
char optr;
cin>>a>>b>>optr;
switch(optr){
case '+':
cout<<a+b;
break;
case '-':
cout<<a-b;
break;
case '*':
cout<<a*b;
break;
case '/':
if(b==0){
cout<<"Divided by zero!";
}
else{
cout<<a/b;
}
break;
default:
cout<<"Invalid operator!";
break;
}
return 0;
}
标签:
Copyright © 2015-2022 每日计算机网版权所有 备案号:浙ICP备2022016517号-15 联系邮箱:5 146 761 13 @qq.com