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

輸入說明:

輸入會已一個正整數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.
[Exercise] Coding (C) - đã hỏi trong 2017-1 程式設計(一)AD bởi (18k điểm)
ID: 34978 - Xem được từ: Không giới hạn - Hiệu lực đến: Không giới hạn

đã sửa bởi | 1.7k đã xem

5 Trả lời

0 thích 0 k thích
Hidden content!
#include * * ** ** * *
#include * ** * ***
#include ** * ** ****


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





    }
        return 0;
}
trả lời bởi (114 điểm)
đã sửa bởi
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 thích 0 k thích
Hidden content!
#include <stdio.h>
int main()
{
**** ** *** * * ** ** * a;
* * * *** * * * * * *** i,j;
*** ***** ** * * **
* ******** **** * ** *** * * * * * *** * * *
*** *** * ** **** ***
* ** *** * * *** * * * * * *** * *
** ** * * * *** * *****
*** * * * *** ** * ** *** * ** ** * * * * *
** * *** ** * ** * ** * * * ** * * * **
** *** ** * * *** **** *** * * * **** ** * * **** * * ** * b[1000],c[1000];
** * ** * *** * *** *** * ** * * ** ** ** **** *** ** * ** * * ** * ***** * %s",b,c);
** *** ****** ** * ** * * **** * * *
* * * * * * * **
    
* * * * ** ** * *** *
* ** * *** ** ** ** * *
*** ** *** ** ** *****
    
    
*** * * ***** * ** * * **** 0;
}
trả lời bởi (236 điểm)
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 thích 0 k thích
Hidden content!
#include <stdio.h>

int main()
{
**** ** ***** * ***** * * * N,i,a,b,c,*ptr;
**** * ** * ***
* ***** *** * * * ** *** ** ****
* ** * ** ** * **
* * ** * * * ** * * * ***
* *** * * *** **
* * ** **** * ** * ** * * * %d",&a,&b);
    }
   
* ** *** * *** * ** *
* ** * * * **** * * ***** **
* ** * *** * * **** * * *****
** ** ** * ** ** ** **** ***
* *** * * ** ** ** ***** *****
** * ** *** **** *** * **** *
* * ** *** * * * * **
** ** *** ** *** ** ** *** **** ****
* ** ** * * ** *** *
**** ** * * ** * * * ** * * %d\n",a,b);
    }
** ** **** ** **
* * *** * * * ******* ** * ** 0;
}
trả lời bởi (215 điểm)
đã sửa bởi
0 0
prog.c:1:1: error: expected identifier or '(' before '.' token
 .
 ^
0 0
Case 0: Wrong output
0 thích 0 k thích
Hidden content!
* * * * * * *
*** * * * *
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;
* * * ** }
*** * **
trả lời bởi (160 điểm)
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 thích 0 k thích
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;
}
trả lời bởi (190 điểm)
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:172.69.6.2
©2016-2025

Những câu hỏi liên quan

3 thích 0 k thích
6 trả lời
[Exercise] Coding (C) - đã hỏi ngày 30 tháng 11 năm 2017 trong 2017-1 程式設計(一)AD bởi Shun-Po (18k điểm)
ID: 34979 - Xem được từ: Không giới hạn - Hiệu lực đến: Không giới hạn
| 1.6k đã xem
3 thích 0 k thích
14 trả lời
[Exercise] Multichoice - đã hỏi ngày 30 tháng 11 năm 2017 trong 2017-1 程式設計(一)AD bởi 楊修俊 (30k điểm)
ID: 34985 - Xem được từ: 2017-11-30 14:00 - Hiệu lực đến: 2017-11-30 14:30
| 1.4k đã xem
3 thích 0 k thích
22 trả lời
[Exercise] Coding (C) - đã hỏi ngày 16 tháng 11 năm 2017 trong 2017-1 程式設計(一)AD bởi Shun-Po (18k điểm)
ID: 33757 - Xem được từ: Không giới hạn - Hiệu lực đến: Không giới hạn
| 5.5k đã xem
2 thích 0 k thích
24 trả lời
[Exercise] Coding (C) - đã hỏi ngày 16 tháng 11 năm 2017 trong 2017-1 程式設計(一)AD bởi Shun-Po (18k điểm)
ID: 33762 - Xem được từ: Không giới hạn - Hiệu lực đến: Không giới hạn
| 4.6k đã xem
3 thích 0 k thích
20 trả lời
[Exercise] Coding (C) - đã hỏi ngày 16 tháng 11 năm 2017 trong 2017-1 程式設計(一)AD bởi Shun-Po (18k điểm)
ID: 33758 - Xem được từ: Không giới hạn - Hiệu lực đến: Không giới hạn
| 4.2k đã xem
12,783 câu hỏi
183,442 trả lời
172,219 bình luận
4,824 thành viên