2 喜歡 0 不喜歡
1.5k 瀏覽

(20%)請撰寫一個程式,幫字串做排序,請依照字典順序作為排序的依據,就是單字在英文字典中出現的順序。

輸入說明:

一開始會輸入一個正整數,代表接下來會有多少個單字要被輸入。輸入的單字不會超過100個,只會有小寫字母。

輸出說明:

請輸入排序後的所有單字,每一個字一行。

 

輸入範例:

6
imagine
imaginary
menagerie
manager
imagining
managing

 

輸出範例:

imaginary
imagine
imagining
manager
managing
menagerie

 

[考試] 最新提問 分類:2017-1 程式設計(一)AD | 用戶: (30k 分)
ID: 43451 - 從幾時開始: 2018-01-19 18:30 - 到幾時結束: 2018-01-19 21:30

修改於 用戶: | 1.5k 瀏覽

5 個回答

0 喜歡 0 不喜歡
內容已隱藏
#include <stdio.h>
#include <string.h>


int main()
{
    int n,i,j;
*** * * ** * **** *** * * * ** ** * * ***** *** ** *
    {
        char str[n][30];
* * **** *** * ** ** * * *** * * ** ** ** **** ** *****
* * ** **** * * ** **** * *** ** ** * * * * *** ****** *** *** * * * *** * * ** * * * **
* ** *** * * *** *** *** *** *** * **** * *** * **** * * * *
        {
** * ** * ** * * * ** * ** *** ** * * ** * ***** * * *** **** ** * *
*** * * * *** * ** ******* ****** * *** *** ** * * ***
** *** ** ** * *** ** ** * * ** **** * * ** *** * * **** ** **** *** ** * * ** * ***** ***** * ** * *** *
* * **** **** ********** ** **** ***** *** * ** ** * * * * * *** ** ***** * **** ** ** ** * ** *
* *** **** *** ** *** * ** * * ** *** **** *** * **** ***** * *** *** *** * * * * * * * ******* ** temp[30];
** ****** * *** ** ** ** ** ** * ** * * ** * ** ** * *** * * * *** ** * **** * * ** ** *** * ** **** ** * * **** ** *
* *** **** ***** * * * * *** * ** * ** ******** ** ****** * * * **** * ** * ** ** * * * ** ** ***** *** ** ***** *** * *** * *
** *** * * ** ** ** * * * * * * *** **** * * ** ** ** *** * ***** * * **** ** * * ** * * * * * * *** ******* * *
**** * ** * * * **** * ** * * * * * * * ***** *** ** *** * ***** ** * ** * *** **
** * ** * *** * ** * * * * ***** * *** * *** **** * *
        }
* ** * * * * * ** ** ********* * * * * * **** *
***** * * ** ** * **** * ** ** ** * ** ***** ****** *** ** ** **** *** * *
    }
    return 0;
}
最新回答 用戶: (114 分)
0 0
Case 0: Correct output
0 喜歡 0 不喜歡
內容已隱藏
#include<stdio.h>

int main()
{
    int n,i,j,k,l,u;
    char ch[100][100],temp[100];
* ** ******* * ** *** ******* * *** * ** * **
    
    for(i=0;i<n;i++)
**** ** ** * ******* * * * * * * **
    
** * * * ** ** * * *** ***
    for(j=0;j<n-1;j++)
    {
*** *** * *** * ** *** * ** * * * * * ** * * **
* * **** **** * * * ** ** * *
*** * *** ** * * ** * ***** ** ** * * * ** * * *** ** **
* * ****** **** * * * ** **** ** ** * * * * ** *** ***
* ** *** * * ** *** * ** * * * ** * * ** * * ** * * ** ** * ****** *** * ** * *
* ***** ***** * * ** * * * * * ** * * ** * * ** * * * **** * **
** *** * * * * *** * * * * ** * * ** ** ** * *** * * * * *** ** ****** * ** *
*** * * * ** * ***** **** * *** * * *** ** * * * ***** *** ** *** *** * ***** ** *
* * *** * *** * *** * * ***** *** *** *** * * ********** * * * *** ** *** * * * * * **
***** * * * * ** ** *** ** * **** ** ** * ** * * * * *** ** * *** * * **** * * * *
* * ** ** ** **** **** * ** * * *** **** * * ** ** **** *** ** * * *** * * *
* * ** *** ** ** * ** * ** ***** * **** * ** * **** * * ** * ** * *
*** ** * * ** * * * ** * * * * ** * * * ***** **** ** * * * * *** * * ** *
* ** * * ** * * * * * * ** ***** * * * ** ******* ******* **
* * * *** * * * ** * * * * * ** * * ****** * **** * ** * ** * * * * * * *** * *
*** * * ** * **** * ** * ******* *** ****** *** * * * **** *** ** * * * **
** *** * *** *** ** * * * ** ** * ******** * *
* **** * * ** ** *** * * * ** ** ** ***
    }
    
    for(i=0;i<n;i++)
*** ** * * **** ** ** * * * * ** * * **
** * * **** * ** ** * *** ** * * * * **
}
最新回答 用戶: (192 分)
修改於 用戶:
0 0
prog.c:1:1: error: expected '=', ',', ';', 'asm' or '__attribute__' at end of input
 test
 ^~~~
0 0
Case 0: Correct output
0 喜歡 0 不喜歡
內容已隱藏
** * ** * * *
int main()
{
* ** * **** * s[i]=[500]
** **** ** * * **** n,i;
**** * ** * *** ** ** *** * * *
* * * ****** * * * * *** * **** * *
* * *** ** **
最新回答 用戶: (162 分)
0 0
prog.c: In function 'main':
prog.c:4:11: error: 'i' undeclared (first use in this function)
    char s[i]=[500]
           ^
prog.c:4:11: note: each undeclared identifier is reported only once for each function it appears in
prog.c:4:14: error: expected expression before '[' token
    char s[i]=[500]
              ^
prog.c:6:17: error: 'n' undeclared (first use in this function)
    scanf("%d\n",n);
                 ^
prog.c:7:4: error: expected declaration or statement at end of input
    scanf("%s\n",s);
    ^~~~~
0 喜歡 0 不喜歡
內容已隱藏
* * *** * **

int main()
{
* * * * * * ** *** a,b,c,d;
*** **** * ****
** ** * * ** * ***** * *** *** * *
*** * **** * * * *
}
最新回答 用戶: (174 分)
0 0
prog.c: In function 'main':
prog.c:7:12: warning: format '%s' expects argument of type 'char *', but argument 2 has type 'int' [-Wformat=]
    scanf("%s",a);
            ^
0 喜歡 0 不喜歡
內容已隱藏
#include<stdio.h>

int main()
{
*** *** **** ** ** ** a;
    
*** * ** ** * ** * * * * *** ***** *** * ***
    
** * ** * * * **** * ** **** * * ** *
* * *** * * *** ** ** * ** ** * * * * *
*** * ** * *** ** ** * ***** *** **** ** *
** * ** *** ** ***** * * * **** * ****
****** * **** * * ******** ** ******* ** * **
* *** *** * * ******* * * *** ** * * **
* * * ** * * *** * *** 0;
}
最新回答 用戶: (215 分)
修改於 用戶:
0 0
Case 0: Wrong output
0 0
Case 0: Wrong output
0 0
Case 0: Wrong output
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.69.214.125
©2016-2025

相關問題

1 喜歡 0 不喜歡
24 回答
[考試] 最新提問 1月 19, 2018 分類:2017-1 程式設計(一)AD | 用戶: 楊修俊 (30k 分)
ID: 43456 - 從幾時開始: 2018-01-19 18:30 - 到幾時結束: 2018-01-19 21:30
| 3.4k 瀏覽
1 喜歡 0 不喜歡
24 回答
[考試] 最新提問 1月 19, 2018 分類:2017-1 程式設計(一)AD | 用戶: 楊修俊 (30k 分)
ID: 43455 - 從幾時開始: 2018-01-19 18:30 - 到幾時結束: 2018-01-19 21:30
| 2.9k 瀏覽
1 喜歡 0 不喜歡
24 回答
[考試] 最新提問 1月 19, 2018 分類:2017-1 程式設計(一)AD | 用戶: 楊修俊 (30k 分)
ID: 43454 - 從幾時開始: 2018-01-19 18:30 - 到幾時結束: 2018-01-19 21:30
| 4k 瀏覽
2 喜歡 0 不喜歡
24 回答
[考試] 最新提問 1月 19, 2018 分類:2017-1 程式設計(一)AD | 用戶: 楊修俊 (30k 分)
ID: 43453 - 從幾時開始: 2018-01-19 18:30 - 到幾時結束: 2018-01-19 21:30
| 3.2k 瀏覽
1 喜歡 0 不喜歡
23 回答
[考試] 最新提問 1月 19, 2018 分類:2017-1 程式設計(一)AD | 用戶: 楊修俊 (30k 分)
ID: 43452 - 從幾時開始: 2018-01-19 18:30 - 到幾時結束: 2018-01-19 21:30
| 2.8k 瀏覽
12,783 問題
183,442 回答
172,219 留言
4,824 用戶