弟兄们,帮帮忙吧,我真写不下去了
查看原帖
弟兄们,帮帮忙吧,我真写不下去了
1066396
szm111213楼主2024/11/20 00:15
#include<bits/stdc++.h>
using namespace std;
string kkk[1005];
char zf;
int iindex = 1,start;
int main()
{
	string a, kk;
	cin >> a;
	for(int i = 0; i < a.size(); i ++)
	{
		if(a[0] == '-' && i == 0)
		{
			kk = '-';
			continue;
		}
		else if(a[0] != '-' && i == 0)
		{
			kk = "+";
		}
		if(a[i] == '+' || a[i] == '-' || a[i] == '=')//!!!为什么这段程序不执行了
		{
			start = i;
			break;
		}
		kk += a[i];
	}
	kkk[iindex] = kk;
	//cout << kk << endl << "------------------" << endl;
	for(int i = start; i < a.size(); i ++)
	{
		if(a[i] == '+' || a[i] == '-' || a[i] == '=')
		{
			if(a[i] == '+' || a[i] == '-')
			{
				zf = a[i];
			}
			int j;
			for(j = i + 1; j < a.size(); j ++)
			{
				if(a[j] == '+' || a[j] == '-' || a[j] == '=')
				{
					break;
				}
			}
			kkk[++ iindex] = zf + a.substr(i + 1, j - i - 1);
			//cout << kkk[iindex] << " ";
		}
		if(a[i] == '=')
		{
			kkk[++ iindex] = "=";
		}
	}
/*	
	for(int i = 1; i <= iindex; i ++)
	{
		cout << kkk[i] << " ";
	}
*/
	//以上为截取每一个数
	for(int i = 1; i <= iindex; i ++)
	{
		bool pd = 1;//判断
		for(int j = 1; j < kkk[iindex].size(); i ++)
		{
			if((kkk[iindex])[i] >= 'a' && (kkk[iindex])[i] <= 'z')
			{
				pd = 0;
			}
		}
		if(pd = 0;)
	}
	return 0;
}
2024/11/20 00:15
加载中...