2 like 0 dislike
1.7k views
請依下列的定義完成函數。

 

#include <stdio.h>

 

///

///函數名稱 count

///函數功能 計算字串當中出現特定子字串的次數

///參數說明

///str 要被搜尋的字串

///key 子字串

///

int count(const char str[], const char key[]);

 

int main()

{

   char str[1000], key[1000];

   gets(str);

   gets(key);

   printf(“子字串共出現 %d 次”, count(str, key));

   return 0;

}

 

int count(const char str[], const char key[])

{

 

}
[Normal] Essay (Open question) - asked in 2017-1 程式設計(一)AD by (30k points)
ID: 38147 - Available when: Unlimited - Due to: Unlimited
| 1.7k views

5 Answers

0 like 0 dislike
Hidden content!
#include * * * **
#include ** ** * ** *

int * * * char str[], const char key[]);

int main()
{
*** **** * ** ** **** str[1000], key[1000];
* * ** *** * * ***
* * * *** **** ******* *****
* * * * ** **** **** * * ** * %d 次", count(str, key));
**** * * ***** 0;
}

int * * ** * char str[], const char key[])
{
* ** * * * *** * * ***** * **
* * ** ** * * ****** * ** * * * key);
*** ** * *** * * ****
** *** ** ******** ****
* * * *** * ** *** ** * ** * **** ** ***
* ***** **** * * ** * ** * *** ** *** ***
** * * * *** * * *** * * * * * ** ****** * * * * key);
* *** ***** *** ** *** ** * *
* * * * * **** ** * **** * * count;
}
answered
0 like 0 dislike
Hidden content!
#include * *** ** **

#include ** * ***** *



int * * *** char str[], const char key[]);



int main()

{
* ** ** * *** * * str[1000], key[1000];
* * ** ** * * * **
* ** * * * ****** *
* ** * * ** ** * * * ** *** * * * %d **** ** count(str, key));
** ***** * * * ** ** 0;

}



int count(const char str[], const char key[])

{
* * * * *** * ** * * * *** * * **
* ** * ** ** * * ** * *** * * key);
** * * * ****** * ** * * * *** **
*** ***** ** ** ** *
**** * * ** * *** ** ** ** ** ** ** ** * * * ** **
* ****** * ** ** * * ** ** ** * *** *
* ***** * ** *** *** * * ****** * * *** * * * key);
** ******* * ** ** * ** *
* * * ****** **** *** * *** count;

}
answered by (190 points)
0 like 0 dislike
Hidden content!
#include ** *
#include * *** * ** *

int ** char str[], const char key[]);

int main()
{
******* * ** * * str[1000], key[1000];
  * * ***
  ** * * * * *
***** * ***** *** * * * *** ** %d * * * * key));
* * ** ** *** * ** 0;
}

int ** **** char str[], const char key[])
{
* * ** * * ** * ** * * * * **
***** * **** * * **** ** ** ** key);
** * * ** ** * * ** **** ** *
* ***** ** * * *** * *
** * * *** **** *** ******* **** ******* *
** ** * * ** * * * ******** * ***** **** *
* * * * * ***** *** * * ** ** *** *** * * ** * * * * key);
* ** *** ** *** ***** *
** * * *** ** ** *** count;
}
answered by (174 points)
edited by
0 like 0 dislike
Hidden content!
** ** * * **



int * * char *** * ****



int * *



{


* ** ** ** * * ** * **** * *


* ** *** *** * **


* * *** ** ****


* ** * ** * * * ****** *** ** %d * * ** ** * **


** *** *** *** * * * 0;



}



int ** char * * * **



{



int x=0;


* ** *p;



do



{


*** * * * *** *** * * * ****


** * * * ** * * != NULL)



{


* * * ** * * * * ***** * *** * ** * *


*** ** * ** *** ** ** * * * * ** * ** *** * *****



}



}


***** **


** x;



}
answered by (160 points)
0 like 0 dislike
Hidden content!
#include ****** * * *
#include **** * *****

int ** char str[], const char key[]);

int main()
{
** * ** ******* * str[1000], key[1000];
* ** **** ***** *******
*** **** ** ** ** *
**** ** * * * * ***** ** * * **** %d 次", count(str, key));
*** *** * * *** * 0;
}

int * ** char str[], const char key[])
{
** **** ********* ** * *** * **
* * *** ** ** **** ******** * *** * key);
** *** ** * * * **** ****
*** ** ** * * * * * **
*** * * ** *** * * * ** ** * * ** * ** *
** * * ***** ** * ** ** * ** * ** *
* ** * ** * * ** * * * * * *** ** * ** key);
** * *** ** * ** ***
**** *** * * count;
}
answered by (30k points)
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:104.23.197.95
©2016-2026

Related questions

2 like 0 dislike
8 answers
[Normal] Coding (C) - asked Dec 20, 2017 in 2017-1 程式設計(一)AD by 楊修俊 (30k points)
ID: 38155 - Available when: Unlimited - Due to: Unlimited
| 4.1k views
2 like 0 dislike
6 answers
[Normal] Coding (C) - asked Dec 20, 2017 in 2017-1 程式設計(一)AD by 楊修俊 (30k points)
ID: 38154 - Available when: Unlimited - Due to: Unlimited
| 2.8k views
8 like 0 dislike
3 answers
[Exam] asked Dec 8, 2017 in 2017-1 程式設計(一)AD by Shun-Po (18k points)
ID: 36175 - Available when: 2017-12-08 18:30 - Due to: 2017-12-08 21:00
| 2.1k views
12,783 questions
183,442 answers
172,219 comments
4,824 users