贾天翯 @ 2021-11-12 19:07:44
#include<iostream>
#include<sstream>
#include<string>
using namespace std;
int main()
{
int state=0;
int n;
string s,t;
cin >> n;
cin.ignore();
while(n--)
{
getline(cin, s);
stringstream ss(s),sss;
int x, y;
if (s[0]>='a'&&s[0]<='c')
{
ss >> t;
switch (s[0])
{
case 'a':
state = 1; break;
case 'b':
state = 2; break;
case 'c':
state = 3; break;
default:
break;
}
}
if (state == 1)
{
ss >> x, ss >> y;
cout << x << '+' << y << '=' << x + y << endl;
sss << x << y << x + y;
sss >> t;
cout << t.size() + 2;
if(n!=0) cout<<endl;
}
else if (state == 2)
{
ss >> x, ss >> y;
cout << x << '-' << y << '=' << x - y << endl;
sss << x << y << x - y;
sss >> t;
cout << t.size() + 2;
if (n != 0) cout << endl;
}
else if (state == 3)
{
ss >> x, ss >> y;
cout << x << '*' << y << '=' << x * y << endl;
sss << x << y << x * y;
sss >> t;
cout << t.size() + 2;
if (n != 0) cout << endl;
}
}
}
by chubei_AC @ 2021-11-12 19:09:00
你谷炸了