60分不知道哪里出现了问题,求助!!!!!!!!
查看原帖
60分不知道哪里出现了问题,求助!!!!!!!!
819682
Exile_Code楼主2023/5/19 14:39
#define  _CRT_SECURE_NO_WARNINGS
#include <iostream>
using namespace std;
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <cstdio>
#include <cstring>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <list>
#include <string>
#include <cmath>
#include <bitset>
int letter[30];
int main()
{
	
	char a; char d;
	int t;
	cin >> t; 
	string s="";int b, c;
	while (t--) {
		b = 0; s = "";
		cin >> d;
		if (isalpha(d)) { 
			cin >> b >> c;
			a = d;
		}
		else {
			while (d != ' ') {
				b += b * 10 + (int)(d - '0');	
                d= getchar();
        //字符转int
			}
			cin >> c;
		}
     //符号判断
		if (a == 'a') {
			s += to_string(b);
			s += "+";
			s += to_string(c);
			s += "=";
			s += to_string(b + c);
		}
		else if(a=='b')
		{
			s += to_string(b);
			s += "-";
			s +=to_string(c);
			s += "=";
			s += to_string(b - c);
		}
		else {
			s += to_string(b);
			s += "*";
			s += to_string(c);
			s += "=";
			s += to_string(b * c);
		}
		cout << s << endl << s.size() << endl;
	}

	return 0;
}

2023/5/19 14:39
加载中...