没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
#include <stdio.h> ///< Define the 'stdio.h' standard header
#define MAXSIZE 100 ///< Define a constant
int find(char *s1, char *subs); ///< declare the find method
int strlen(char *string); ///< declare the strlen method
, sumOfVertical = 0, sumOfDiagonal1 = 0, sumOfDiagonal2 = 0
int main() {
char s1[MAXSIZE], s2[MAXSIZE], s3[MAXSIZE]; ///< declare three variables string
gets(s1);
gets(s2);
gets(s3); ///< read the three strings
printf("%d %d", find(s1, s2), find(s1, s3));
}
// A method to find the occurrence number of the substring in a string
int find(char *s1, char *subs)
{
int i, j;
int count = 0;
int str1 = strlen(s1), strSub = strlen(subs); // call the method strlen to calculate the length of the string
for (i = 0;i < str1 - strSub + 1; i++)
{
for (j = 0; j < strSub; j++) // traverse the substring
{
资源评论
qiuzhujin
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功