这个程序为什么无法运行?报错是count是不明确的符号
题目是字符串匹配,要求读入两个字符串a,b,判断前者是否是后者的字串,输出为前者在后者出现过几次
#include <iostream>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
using namespace std;
char a[50], b[50];
int la, lb, count;
void input_data()
{
cin >> a;
cin >> b;
}
void solve()
{
bool match;
la = strlen(a);
lb = strlen(b);
count = 0;
for (int i = 0; i <= lb - la; i++)
{
match = true;
for (int j = 0; j < la; j++)
{
if (a[j] != b[i + j])
{
match = false;
break;
}
}
if (match)
count++;
}
}
void output_data()
{
if (count == 0)
cout << "NONONO" << endl;
else
cout << count << endl;
}
int main()
{
input_data();
solve();
output_data();
return 0;
}