image

编辑人: 独留清风醉

calendar2025-05-31

message9

visits309

编写一个函数,该函数可以统计一个长度为2的字符串在另一个字符串中出现的次数。例如,假定输入的字符串为:asd asasdfg asd as zx67 asd mklo,子字符串为as,则应输出6。

#include

#include

#include

int fun(char *str,char *substr)

{

}

main()

{

char str[81],substr[3];

int n;

clrscr() ;

printf(“输入主字符串: “);

gets(str);

printf(“输入子字符串: “);

gets(substr);

puts(str);

puts(substr);

n=fun(str,substr);

printf(“n=%d
”,n);

}

喵呜刷题:让学习像火箭一样快速,快来微信扫码,体验免费刷题服务,开启你的学习加速器!

分享文章
share