3 喜歡 0 不喜歡
3.2k 瀏覽
小明在一間公司當行政助理,他主要的工作是處理寄給客戶的電子郵件,寄給不同客戶的信件通常內容大致都一樣,只有幾個關鍵字不同而已,請寫一個程式,來幫助小明更輕鬆的完成他的工作。

輸入說明:

輸入會已一個正整數N作為開始,代表有多少個關鍵字要被置換,接下來的N行,每一行會有兩個字串,代表要被置換的關鍵字以及要置換成的新字串,最後是信件的本文,信件的本文會是一個包含空白字元的字串。

輸出說明:

請將新的信件本文完整的輸出在螢幕上。

輸入範例:

2

100 1000

Jack John

Dear Jack, You still owe me $100, pay off please.

輸出範例:

Dear John, you still owe me $1000, pay off please.
[練習] Coding (C) - 最新提問 分類:2017-1 程式設計(一)AD | 用戶: (18k 分)
ID: 34978 - 從幾時開始: 無限制 - 到幾時結束: 無限制

修改於 用戶: | 3.2k 瀏覽

5 個回答

0 喜歡 0 不喜歡
內容已隱藏
#include * *** ****
#include * ** *
#include *** * ***


int main()
{
    int n;
    int i,k,len;
    char **** * *** * **** *** * * * ** ** ** * ******* * **
    char *p;
    int ** ** * * * *
****   * ** *** ********** **** *
***** ** *** * *** *** *
**** * ** * *** * ** * ** * * **** ***** **** ***
* ** ** ****** **** *** ***** ** * * **** ** * * * ** *
* * * * **** * * ** * *** * * ** * ** * * **** * **
**** *** ** ***** ** * ******* * * * *** ******* * *** *** ** * * *** ** ** *** ** *
*** ** * * * **** * **** * * * * * * * *** **
*** ** **** ** * * ** * ******* *** *** *** **** **
** **** ** ** ** * * * * * * * *** * * * ** * ** ** *
* *       ** *******
* *       ****** * * *
* * *       * **** * * ****
** *       * ** *
* ** *** ** ****** ****** * *** * * ** * * **
** * *** * * * *** **** ** ** * ** *** * * ** *** * **** ** * * * **** ***
*** * * *** *** * * ** ** ** * * ** ** ** ** **** **** * *** *********
* * ** **** * * *** *** * * *** * ***** **** * *** * ***** *** * ** ********* ** *
***** * * * *** ****** * * * * * * * * * **
** * ** ** ** * *** ** * ** * ** *** ****** *** *****





    }
        return 0;
}
最新回答 用戶: (114 分)
修改於 用戶:
0 0
Case 0: Wrong output
0 0
Case 0: Wrong output
0 0
prog.c: In function 'main':
prog.c:29:15: warning: null argument where non-null required (argument 1) [-Wnonnull]
             p=strstr(NULL,before[index]);
               ^~~~~~
0 0
Case 0: Wrong output
0 喜歡 0 不喜歡
內容已隱藏
#include <stdio.h>
int main()
{
* *** * *** ** ** a;
*** * ****** ** ***** * i,j;
**** *** * ** * * **
* *** *** *** ** * * ** * * ** ** * ** *
** * * * * ** *** *
*** ** ******* **** ** * * *** *
* * ***** ** ** **** **
* * * **** * * ** * ** ** *** * * * * * *** ** * ** **
* *** * *** ** *** * *** * * **
**** *** * ** ** * * * **** ** ** * **** * ** * **** **** * *** *** b[1000],c[1000];
* * **** *** * * * ** ** *** ** * * *** * * ** **** **** ** ******* %s",b,c);
*** ** * ** ** ***** ** * *** * * * *
******** * * * ** * *
    
* ********** * ** **
**** * ** *** * *
** * * ** * * *** * *
    
    
* * ** *** ** * ** **** *** *** 0;
}
最新回答 用戶: (236 分)
0 0
prog.c: In function 'main':
prog.c:14:21: warning: format '%s' expects argument of type 'char *', but argument 2 has type 'int *' [-Wformat=]
             scanf("%s %s",b,c);
                     ^
prog.c:14:24: warning: format '%s' expects argument of type 'char *', but argument 3 has type 'int *' [-Wformat=]
             scanf("%s %s",b,c);
                        ^
0 喜歡 0 不喜歡
內容已隱藏
#include <stdio.h>

int main()
{
* * * * * *** * * ** N,i,a,b,c,*ptr;
* ***** * * * ****
* ** ** * * ** ** * ** ***** ** *** ** *
*** * *** ** * * ***
* * * * * **** * * * *** *** * ***
*** *** **
** * * ** ** * * ** * * ** ******* %d",&a,&b);
    }
   
** * **** * * ***** * * * *
* ** ** * *** *
** **** ****** ** ***** *** * *
*** *** * * ** ** *
** ** * * *** * * * * * * **
* * ***** * ***** * * *
* * ***** ** *** ** *
* * ** * *** ***** ** * * **
****** ** * * ** ** * *
* * * ** * * ** * * *** * ** ** %d\n",a,b);
    }
***** * ******** ** * * **
***** * *** * ** ** **** ******* 0;
}
最新回答 用戶: (215 分)
修改於 用戶:
0 0
prog.c:1:1: error: expected identifier or '(' before '.' token
 .
 ^
0 0
Case 0: Wrong output
0 喜歡 0 不喜歡
內容已隱藏
* ** * ****
**** ** *** *** ** *
int * ****** ** *
{
* * * int i,j;
* * *   int set=0;
* *** * **** **** **** * ***** ****
* ***** ** {
**     *** * * *** **** * **
** **** * *** * *** {
* *** * ** * *** ** * * * * *** *** * ** * *** * ***
**** ** * * *** * ** ** *** ** * set++;
* ** ** * * * ** ** }
** * * * * * * **** ** **** *** ****
** * ** * *** * * ** set=0;
** * * ** }
*** * * * * * *
* *** ** return 1;
** * * * ** else
* * return 0;
}

int main()
{
* * * ** int n;
*** ***   *** ** * **** ** * * **
* *****   {
* * * **     * *** char str[1000];
* * *   * * **   char ** ***
** **** * * * * * ******* char ** ** *
* * ** * * **   char ******
***** * * * *** *** * char *temp;
* ** ** ** * *** char *pch;
**** ** * * ** * * int orilen;
* * * * * *** * ****
* **** * **** *****
* * * **** * ***** * * * **
* ** * *** * ** * * * *** *
* * * **** *** *** * * ** * *
** *** **** * * * *** **
* ** * **** ** * * * * ** * * * **** *
*** ** ** * ** *** ** * * ** {
* * ** * * * * ** * * * ** * ** pch = ** ** ***
* *** ** ** * * * ** ** **** * *** ** * ** *** ** * *** *
** ** * ** * * * * *** *** ** ** *** * ** * **
**** * * ** * * * }
***** * * * * * ** * return 0;
** *** * **** }
* **
最新回答 用戶: (160 分)
0 0
prog.c: In function 'main':
prog.c:36:3: warning: 'gets' is deprecated [-Wdeprecated-declarations]
   gets(search);
   ^~~~
In file included from prog.c:1:0:
/usr/include/stdio.h:640:14: note: declared here
 extern char *gets (char *__s) __wur __attribute_deprecated__;
              ^~~~
prog.c:37:3: warning: 'gets' is deprecated [-Wdeprecated-declarations]
   gets(change);
   ^~~~
In file included from prog.c:1:0:
/usr/include/stdio.h:640:14: note: declared here
 extern char *gets (char *__s) __wur __attribute_deprecated__;
              ^~~~
prog.c:38:3: warning: 'gets' is deprecated [-Wdeprecated-declarations]
   gets(str);
   ^~~~
In file included from prog.c:1:0:
/usr/include/stdio.h:640:14: note: declared here
 extern char *gets (char *__s) __wur __attribute_deprecated__;
              ^~~~
/tmp/ccLepvJq.o: In function `main':
prog.c:(.text+0x12a): warning: the `gets' function is dangerous and should not be used.
0 喜歡 0 不喜歡
內容已隱藏
#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;
}
最新回答 用戶: (190 分)
0 0
prog.c: In function 'main':
prog.c:9:4: warning: 'gets' is deprecated [-Wdeprecated-declarations]
    gets(str);
    ^~~~
In file included from prog.c:1:0:
/usr/include/stdio.h:640:14: note: declared here
 extern char *gets (char *__s) __wur __attribute_deprecated__;
              ^~~~
prog.c:10:4: warning: 'gets' is deprecated [-Wdeprecated-declarations]
    gets(key);
    ^~~~
In file included from prog.c:1:0:
/usr/include/stdio.h:640:14: note: declared here
 extern char *gets (char *__s) __wur __attribute_deprecated__;
              ^~~~
/tmp/cc5PeT7t.o: In function `main':
prog.c:(.text+0x25): warning: the `gets' function is dangerous and should not be used.
0 0
prog.c: In function 'main':
prog.c:9:4: warning: 'gets' is deprecated [-Wdeprecated-declarations]
    gets(str);
    ^~~~
In file included from prog.c:1:0:
/usr/include/stdio.h:577:14: note: declared here
 extern char *gets (char *__s) __wur __attribute_deprecated__;
              ^~~~
prog.c:10:4: warning: 'gets' is deprecated [-Wdeprecated-declarations]
    gets(key);
    ^~~~
In file included from prog.c:1:0:
/usr/include/stdio.h:577:14: note: declared here
 extern char *gets (char *__s) __wur __attribute_deprecated__;
              ^~~~
/tmp/ccBzifWs.o: In function `main':
prog.c:(.text+0x25): warning: the `gets' function is dangerous and should not be used.
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:104.23.197.239
©2016-2026

相關問題

3 喜歡 0 不喜歡
6 回答
[練習] Coding (C) - 最新提問 11月 30, 2017 分類:2017-1 程式設計(一)AD | 用戶: Shun-Po (18k 分)
ID: 34979 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 3.2k 瀏覽
3 喜歡 0 不喜歡
14 回答
[練習] 多選題 - 最新提問 11月 30, 2017 分類:2017-1 程式設計(一)AD | 用戶: 楊修俊 (30k 分)
ID: 34985 - 從幾時開始: 2017-11-30 14:00 - 到幾時結束: 2017-11-30 14:30
| 2.4k 瀏覽
3 喜歡 0 不喜歡
22 回答
[練習] Coding (C) - 最新提問 11月 16, 2017 分類:2017-1 程式設計(一)AD | 用戶: Shun-Po (18k 分)
ID: 33757 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 9.1k 瀏覽
2 喜歡 0 不喜歡
24 回答
[練習] Coding (C) - 最新提問 11月 16, 2017 分類:2017-1 程式設計(一)AD | 用戶: Shun-Po (18k 分)
ID: 33762 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 8k 瀏覽
3 喜歡 0 不喜歡
20 回答
[練習] Coding (C) - 最新提問 11月 16, 2017 分類:2017-1 程式設計(一)AD | 用戶: Shun-Po (18k 分)
ID: 33758 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 7.3k 瀏覽
12,783 問題
183,442 回答
172,219 留言
4,824 用戶