为什么会编译失败
查看原帖
为什么会编译失败
867224
miaoshou楼主2024/9/7 09:03
#include<iostream>
#include<math.h>
#include<iomanip>
#include<string>
using namespace std;
bool isHws(int n);
typedef struct
{
	int x;
	int y;
}pos;
pos huoba[97];
pos yingshi[65];
string numTostr(int n);
int main()
{
	int k = 0;
	int ans=-1;
	int anss=9999999;
	string example;
	string sen[1000100];
	cin >> example;
	while (cin >> sen[k])
	{
		k++;
	}
	for (int i = 0; i < example.size(); i++)
		example[i] = tolower(example[i]);

	for (int i = 0; i<=k; i++)
	{
		for (int j = 0; j < sen[k].size(); j++)
		{
			sen[k][j] = tolower(sen[k][j]);
		}
	}
	for (int i = 0; i <= k; i++)
	{
		if (example._Equal(sen[i]))
		{
			ans++;
			if(anss>i)
				anss = i;
		}

	}
	if (ans >= 0)
		ans = ans + 1;
	cout << ans << " ";
	if (ans >= 0)
		cout << anss << endl;
	
	return 0;
}
string numTostr(int n)
{
	int tagg = 0;
	if (n < 0)
	{
		tagg = 1;
		n *= (-1);
	}
	string ans;
	while (n>=0)
	{
		ans =char((n % 10) + '0') + ans;
		n /= 10;
		if (n == 0)
			break;
	}
	
	if (tagg == 1) ans = '-' + ans;
	return ans;
}
2024/9/7 09:03
加载中...