8 thích 0 k thích
440 đã xem
請寫一個程式,找出一個句子當中出現頻率最高的單子。

 

輸入說明:

會輸入一個英文句子,以”.”作為結束。

 

輸出說明:

輸出句子當中出現最多次的單字,請將所有字母轉成小寫,如果沒有一個單字是最多的,就在螢幕上輸出none。

 

輸入範例1:

This is a pen.

 

輸出範例1:

none

 

輸入範例2:

Pen pineapple apple pen.

 

輸出範例2:

pen
[Exam] đã hỏi trong 2017-1 程式設計(一)AD bởi (18k điểm)
ID: 36175 - Xem được từ: 2017-12-08 18:30 - Hiệu lực đến: 2017-12-08 21:00
| 440 đã xem

3 Trả lời

0 thích 0 k thích
Hidden content!
#include<stdio.h>
int main()
{
* ** ***** ** ** ch1();
* * * ** * * ** * * * * * **
    {
* * * * * * * ***** * ** * *********** ** * ** *
* *** * *** *** *** * * *** **** ** ** *** * ** *** * *** *** *
* * ** * ** ** * ** * * * * *
*** ** * ** * *** ** ** * ** * * * ** ** *
** ***** ** * ** ** ** * * * ** * ** * * ** **** * **
* ***** * * * *** * * *** * ** ** * **
* * * *** * **** ** ** *** **** * * * * ** * * **** **** ** ** * * * ** ** *** ** * * *
** ******** * * * ** **** *
* * * ***** * **** ** * ****** * * * *** *** *** **** *    
* ***** * * ** * *** * ****** *******
* ** * *** * ** ***** * 0 ;
    
    
    }
trả lời bởi (194 điểm)
đã sửa bởi
0 0
prog.c:2:24: error: expected ';', ',' or ')' before 'str'
 int count(const char[] str, const char key[]);
                        ^~~
prog.c: In function 'main':
prog.c:8: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:9:11: error: stray '\342' in program
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
           ^
prog.c:9:12: error: stray '\200' in program
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
            ^
prog.c:9:13: error: stray '\234' in program
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
             ^
prog.c:9:14: error: stray '\345' in program
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
              ^
prog.c:9:15: error: stray '\205' in program
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
               ^
prog.c:9:16: error: stray '\261' in program
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
                ^
prog.c:9:17: error: stray '\344' in program
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
                 ^
prog.c:9:18: error: stray '\275' in program
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
                  ^
prog.c:9:19: error: stray '\277' in program
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
                   ^
prog.c:9:20: error: stray '\347' in program
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
                    ^
prog.c:9:21: error: stray '\224' in program
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
                     ^
prog.c:9:22: error: stray '\250' in program
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
                      ^
prog.c:9:23: error: stray '\344' in program
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
                       ^
prog.c:9:24: error: stray '\272' in program
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
                        ^
prog.c:9:25: error: stray '\206' in program
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
                         ^
prog.c:9:27: error: expected expression before '%' token
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
                           ^
prog.c:9:30: error: stray '\347' in program
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
                              ^
prog.c:9:31: error: stray '\250' in program
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
                               ^
prog.c:9:32: error: stray '\256' in program
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
                                ^
prog.c:9:33: error: stray '\350' in program
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
                                 ^
prog.c:9:34: error: stray '\213' in program
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
                                  ^
prog.c:9:35: error: stray '\261' in program
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
                                   ^
prog.c:9:36: error: stray '\346' in program
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
                                    ^
prog.c:9:37: error: stray '\226' in program
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
                                     ^
prog.c:9:38: error: stray '\207' in program
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
                                      ^
prog.c:9:39: error: stray '\345' in program
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
                                       ^
prog.c:9:40: error: stray '\255' in program
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
                                        ^
prog.c:9:41: error: stray '\227' in program
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
                                         ^
prog.c:9:42: error: stray '\346' in program
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
                                          ^
prog.c:9:43: error: stray '\257' in program
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
                                           ^
prog.c:9:44: error: stray '\215' in program
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
                                            ^
prog.c:9:45: error: stray '\342' in program
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
                                             ^
prog.c:9:46: error: stray '\200' in program
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
                                              ^
prog.c:9:47: error: stray '\235' in program
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
                                               ^
prog.c: At top level:
prog.c:13:24: error: expected ';', ',' or ')' before 'str'
 int count(const char[] str)
                        ^~~
0 0
prog.c: In function 'main':
prog.c:6:15: warning: missing terminating " character
     for(;ch1!=";)
               ^
prog.c:6:15: error: missing terminating " character
     for(;ch1!=";)
               ^~~
prog.c:7:5: error: expected expression before '{' token
     {
     ^
prog.c:21:5: error: expected declaration or statement at end of input
     }
     ^
0 thích 0 k thích
Hidden content!
** * * * ** ****
int main ()
{
** * ** * * * * ***
** * *** ** ********* * * ***** *
* * * * * ** **
** ** * *** * * ** * * ** 0;
}
trả lời bởi (215 điểm)
đã sửa bởi
0 0
Case 0: Wrong output
Case 1: Correct output
Case 2: Wrong output
Case 3: Wrong output
0 0
Case 0: Wrong output
Case 1: Correct output
Case 2: Wrong output
Case 3: Wrong output
0 thích 0 k thích
Hidden content!
#include<stdio.h>
int main(void)
{
* ** *** *** * * *** **** * **** ********* last=0,cnt=0,num;
       while(1)
     {
* ** * ** **** * *** ****** * **** ****** * *** * * *** input number");
* * ** ** **** **** ***** * ** * * * * * * **** * ** *
**** **** ** * * * * ** * ** ** ** * * *
* **** ** * ** ** * * * * * ** ** ** *** * * * **
* ** * *** * * ** *** * * * * * ** * * * ** ********* ** * ** * * ** * **** * ** * * *
**** *** * *** * *** ** * * * ** * * **
   }
** * * ** * * **** ** * ** * * * *** ** * *** * *** * ** * ** * * * * *** * * * * ** *** ** * ** *** ** *
****** ** * ** * ***** * * * * * *** ** * * *** * * * *** * ** * ** ** ** *** **** * *
* * ** ****** **** ** * *** ***** ** 0;
}
trả lời bởi (190 điểm)
0 0
prog.c: In function 'main':
prog.c:13:4: error: expected expression before '}' token
    }
    ^
prog.c:14:26: warning: format '%d' expects argument of type 'int', but argument 2 has type 'int *' [-Wformat=]
                 printf("%d\n",&num);
                          ^
prog.c:15:17: warning: implicit declaration of function 'system' [-Wimplicit-function-declaration]
                 system("pause");
                 ^~~~~~
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:108.162.216.206
©2016-2024

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

2 thích 0 k thích
8 trả lời
[Normal] Coding (C) - đã hỏi ngày 20 tháng 12 năm 2017 trong 2017-1 程式設計(一)AD bởi 楊修俊 (30k điểm)
ID: 38155 - Xem được từ: Không giới hạn - Hiệu lực đến: Không giới hạn
| 1.3k đã xem
2 thích 0 k thích
5 trả lời
[Normal] Essay (Open question) - đã hỏi ngày 20 tháng 12 năm 2017 trong 2017-1 程式設計(一)AD bởi 楊修俊 (30k điểm)
ID: 38147 - Xem được từ: Không giới hạn - Hiệu lực đến: Không giới hạn
| 441 đã xem
12,783 câu hỏi
183,443 trả lời
172,219 bình luận
4,824 thành viên