问答题 【程序功能】 统计一个字符串中包含的字母串个数并找出其中最长的字母串。 所谓字母串是指一个连续的字母序列(不区分大小写),字母串之间用非字母字符分隔。函数count的功能是统计p指向的字符串中包含的字母串个数,找出的最长字母串存放在pmax指向的数组中,函数返回字母串的个数。 【测试数据与运行结果】 测试数据:you are teaeher234too. 屏幕输出:a=you are teacher234too. number is 4 max string is:teacher 【含有错误的源程序】 #include #include #include int count(char p[],char pmax[]) { int j=0,k,m=0; char temp[100]; while(*p) { while((!isalpha(*p)) && *p) p++; k=0; if(*p!='/0') m++; while(isalpha(*p)) temp[k++]=*p++; temp[k]="/0"; if(k
【正确答案】改错1:将第13行 "temp[0]="/0" 修改为 temp[0]='/0' 改错2:将第 14行 if(kj) 改错3:将第16行 pmax=temp,修改为 strcpy(pmax,temp); 改错4:将第24行i=count(a[],max[])修改为i=count(a,max);
【答案解析】