#include <stdio.h>
2 #include <string.h>
3 #include <stdlib.h>
4
5 void sort(char *wilst[], int size){
6 for(int i=0; i<=size; i++){
7 if( strcmp (wilst[i], wilst[i+1] ) <0) {
8 wilst[i] = wilst[i+1];
9 }else{
10 wilst[i+1] = wilst[i];
11 }
12
13 }
14
15 }
16 int main(){
17
18 char word[100];
19 int numWords=0;
20 char * word_list[100];
21
22 while(scanf("%s", word)!=EOF){
23
24 word_list[numWords] = (char *)malloc(strlen(word)+1);
25 strcpy(word_list[numWords],word);
26 numWords++;
27
28 if(numWords>=100)
29 break;
30
31 }
32
33 sort(word_list, numWords);
34
35 for(int j=0; j<=numWords; j++){
36 printf("%s\n", word_list[j]);
37
38 }
39
40 for(int n=0; n<numWords; n++){
41 free(word_list[n]);
42 }
43
44 return 0;
45 }
46
47
~
~
ㅁㅈㅎ
http://pastebin.com/R7NxsRi5
응 이제 소팅하는 거만 알아서 고치면 돼
와 감사합니다 ㅠㅠ;
사실 소트하는 부분까지 만들었는데 그걸 내가 해주면 안되는거지. 저 상태에선 소트 로직에 문제가 있어서 계속 오류날꺼야. 로직 고민해봐
학교서 뭘 배웠는지 모르겠지만 정 안되면 버블정렬 이라는 방법이라도 써봐
이제 잔다
소트 그냥 저렇게는하면안되죠?