还有最后的那些count是什么意思,我没找到
#include <string.h>
#include <stdio.h>
#include <malloc.h>
typedef struct line
{
char *data;
struct line *next;
} LINE;
int FindString(LINE *&head, char *str) {
LINE *p = head;
int count = 0;
int h = 0;
int len1 = 0;
int len2 = strlen(str);
int i, j, k;
do
{
len1 = strlen(p->data);
for (i = 0; i < len1; i++)
{
if (p->data[i] == str[0])
{
k = 0;
for (j = 0; j < len2; j++)
if (p->data[i + j] == str[j])
k++;
if (k == len2)
{
count++;
i = i + k - 1;
}
}
}
}
while ((p = p->next) != NULL);
return count;
}
do {printf(" 请输入你要选择的操作 : ");
scanf("%d", &operate);
switch (operate)
{
case 1:
printf(" 请输入要统计的字符串 :");
scanf("%s", &str1);
printf("%s 出现的次数为 :%d \n", str1, FindString(head, str1));
printf("\n");
CountAll(head);
CountNumber(head);
CountLetter(head);
CountSpace(head);
break;
}
}
while (operate != 0);
}