打表英雄到此一游

一根大香蕉  •  10天前


怕一些人抄我答案,所以设置了一点坑...... (往下看!)

include <bits/stdc++.h>

using namespace std; int ans; void ddd(){cout << "Divided by zero!" << endl;} void ddd2(){cout << "Invalid operator!" << endl;} void bbb(){cout << ans << endl;} main() {

int a,b;
char 
ans = (c=='+'?a+b:(c=='-'?a-b:(c=='*'?a*b:(c=='/'?(b==0?-1:a/b):-2;
ans==-1?ddd():(ans==-2?ddd2():bbb());
return 0;

}


Comments:


一根大香蕉  •  10天前

一根大香蕉  •  10天前

一根大香蕉  •  10天前

一根大香蕉  •  10天前

一根大香蕉  •  10天前

include <bits/stdc++.h>

using namespace std; int ans; void ddd(){cout << "Divided by zero!" << endl;} void ddd2(){cout << "Invalid operator!" << endl;} void bbb(){cout << ans << endl;} signed main() {

int a,b;
char c;
cin >> a >> c >> b;
ans = (c=='+'?a+b:(c=='-'?a-b:(c=='*'?a*b:(c=='/'?(b==0?-1:a/b):-2))));
ans==-1?ddd():(ans==-2?ddd2():bbb());
return 0;

} (这是正确答案!)


一根大香蕉  •  10天前