qwq

P1957 口算练习题

zhenghaoHoney @ 2024-08-25 10:12:33


#include<iostream>
#include<cstring>
#include<string>

using namespace std;

string a,b,c;
int i;
int main(){
    cin>>i;
    for(int j=0;j<i;j++)
    {
        string k;
        cin>>k;
        if(k[0]>='a'&&k[0]<='z')
        {
            a=k;
            cin>>b>>c;
        }
        else
        {
            b=k;
            cin>>c;
        }
        if(a[0]=='a')
        {
            int b1=stoi(b);
            int c1=stoi(c);
            cout<<b<<"+"<<c<<"="<<b1+c1<<endl;
        }
        else if(a[0]=='b')
        {
            int b1=stoi(b);
            int c1=stoi(c);
            cout<<b<<"-"<<c<<"="<<b1-c1<<endl;
        }
        else if(a[0]=='c')
        {
            int b1=stoi(b);
            int c1=stoi(c);
            cout<<b<<"*"<<c<<"="<<b1*c1<<endl;
        }
    }
    cout<<a<<" "<<b<<" "<<c;
    return 0; 
}

by hhztl @ 2024-08-25 10:15:14

@zhenghaoHoney 你想说什么?


by zhenghaoHoney @ 2024-08-25 10:19:54

@hhztl AC了


by hhztl @ 2024-08-25 10:21:26

@zhenghaoHoney 那紫衫吧(


|