0 like 0 dislike
2.3k views
子字串

請設計一個程式,使用者會輸入兩個字串,兩個字串間用一個空格隔開,每個字串的內容只會包含大小寫的英文字母,請判斷第二個字串是否出現在第一個字串內。請將大小寫視為同一個字。

輸入範例1:

friEND end

輸出範例1:

There is "end" in "friEND"

輸入範例2:

friEND friends

輸出範例2:

There are no "friends" in "friEND"
asked in 2016-1 程式設計(一)AD by (18k points) | 2.3k views

23 Answers

0 like 0 dislike
Hidden content!
#include<stdlib.h>

#include<stdio.h>

#include<string.h>

#include<ctype.h>



int main()



{
** ******* * ***** **** **** i=0,j=0,t;
** ** * * ** **** ch,xh;
***** *** * ** ** * * * * ***** a[100],c[100];
* ** * * * ** * * **** b[100],d[100];
* * *** * *** ** ** ** *
* **** **** * **** ** ((ch = getchar()) != 32) {

**** ** * **** * * * *** ** * * * ** *** ** *** = ch;
*** * * ** ** * ** ** * * * * * * * ** *** ** **
* * ** * ** ** ** **
* * ** * *** * * ****
** * *** ** ** ** ** * * * * = getchar()) !='\n') {
*** ******* **** * ********** ** * ** ** * * **** = xh;
* **** ** ** * **** *** * * * *** * ** *
**** ** *** ** * *** ** ** **
* * ***** *** ** * **
**** ** ***** * * ** * * **** {
* **** * ** ***** * ** * * * *** * **** **
* * * * *** ** * ** ********** ** ** *** **** * {
* * ***** * * * **** * * ** * * ** * ******* *** * * * ** *
* * ** ** **** ** *** * **** * ** ** **** ***
** ** * * * ***
* * * * * *** *
*** ** *** * * *** ** **** * *** ** {
* * * * *** *** ******* ******* * ** ** * * *
** * * * *** * *** ** ***** * * ** * * * * * *** {
** **** * * *** * ** * * ** * * ** * ** *** * *
*** * * **** * ** * ****** * * * * * *
* *** * * * * **** * ****   

    


* * ** ***** ** * * * ** * ** * {
** * *** * ** * * ** * ** ** ******** * * ** * **** ** * is \"%s\" in \"%s\"",d,c);
* * **** * ** * *
** * *** * * *** * ***
******* * * * * * ** {
** ** ** * *** *** *** * ****** * ** ***** * are no \"%s\" in \"%s\"",d,c);
** **** * * ***

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

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

#include * * ***

#include *** ** ***

#include * * *



int main(void){
*** ** ***** ** ** *** * * *** **
* *** ** **** * i = 0;

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

  
** ** ** **** * **** != '\0';i++)
* * * * * *** ***** *** * = tolower(c[i]);
*** ** * * * *** = '\0';
*** * ******* * * ** * * ** * **
** ** *** ***** * ** != '\0';i++)
* ** * * *** * **** ** *** ***** = tolower(cc[i]);
** * * * * = '\0';
*** * **
***** * * ******** * * != NULL)
* ** **** * * * **** * ** * ** * *** is ******* ** in ** ***** **** * **
* ** * ** **
*** * ** * * * ** ***** * ** ** ****** **** are no **** ** ** ** in ** * **** *** * *** * ****** * **
** *** * ** * * * ** * * * * **
*** * ** **
** * *** * * **** ***** **** *  
* *** ***** *** * * 0;

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

#include *** **

#include * ** *** * **

#include * ***** * ** *



int main(int argc, char *argv[])

{
**** ** * * * * ****** *** * **
*** * i = 0;
* * ******* * * *
** * * * ** ** * *** *** *
* * * *
* *** ** **** * * * != '\0';i++)
** *** **** * * * ** * * * ** ** * ** * * = tolower(c[i]);
*** * **** * ****** * ** != '\0';i++)
*** * * *** ** ***** * * * * = tolower(cc[i]);
* * * * * ***
* * * ** ** **** ***** != NULL)
** ** * * * *** ***** * * * *** * is ** * * * in * ******** ** * * ***
* * * ***** *
* ** ** *** *** ** ******* ** **** ** are no *** ** * * * in ***** ** *** *****
**** ** *** ** ** ** *

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

}
answered by (-216 points)
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.69.59.125
©2016-2025

Related questions

0 like 0 dislike
0 answers
[Resource] asked Dec 31, 2016 in 2016-1 程式設計(一)AD by laich (937 points)
ID: 20299 - Available when: Unlimited - Due to: Unlimited
| 16 views
0 like 0 dislike
0 answers
[Resource] asked Dec 31, 2016 in 2016-1 程式設計(一)AD by laich (937 points)
ID: 20297 - Available when: Unlimited - Due to: Unlimited
| 17 views
0 like 0 dislike
121 answers
[Exercise] Coding (C) - asked Oct 27, 2016 in 2016-1 程式設計(一)AD by Shun-Po (18k points)
ID: 15385 - Available when: 2016-10-27 18:30:00 - Due to: 2016-10-27 21:00:00
| 8.7k views
0 like 0 dislike
54 answers
[Normal] Coding (C) - asked Oct 11, 2016 in 2016-1 程式設計(一)AD by Shun-Po (18k points)
ID: 13021 - Available when: Unlimited - Due to: Unlimited
| 4.4k views
12,783 questions
183,442 answers
172,219 comments
4,824 users