根据输入的数字及运算符对输入的两个数进行运算。输出结果。
Input
输入为一行。先输入第一个数,空格,输入运算符,再空格,输入第二个数。回车结束输入。
输入的运算符只会是“+”或者“-”。
Output
输出运算的结果。
Sample
Inputcopy | Outputcopy |
---|---|
1111111111 - 1 45 + 873 |
1111111110 918 |
Hint
输入的运算符只会是“+”或者“-”。测试输入可能会比较大。需要用长整型。
//
#include<bits/stdc++.h>
using namespace std;
int main()
{
long long a,b;
char ch;
// %c not %ch
while( ~scanf("%lld %c %lld",&a,&ch,&b) )
{
if( ch=='+' ) cout<<a+b<<endl;
else cout<<a-b<<endl;
}
return 0;
}