user-0 提问: 这个为什么不允许我输入就直接输出了

回复:
user: user-1
content: #include<stdio.h>  #define N       10  struct entry {     char word[15];     char defination[200]; };  void dictionarySort(struct entry Sort[],int n);  int main (void) {     //int N;     int i,j;     struct entry dictionary[N];     printf("please input the words' number do you want to entry.\n");     for(i=0;i<N;i++)     {         char c=getchar();         while(c!='\n')         {             //dictionary[i].word[j]=getchar();             dictionary[i].word[j]= c;             c = getchar();             j++;         }         dictionary[i].word[j] = 0;   //add '\0'         i++;     }     printf("Please input their defination.\n");     for(i=0;i<N;i++)     {         char c=getchar();         while(c!='\n')         {             //dictionary[i].defination[j]=getchar();             dictionary[i].defination[j]= c;             c = getchar();             j++;         }         dictionary[i].defination[j] = 0;    //add '\0'         i++;     }     dictionarySort(dictionary,N);      return 0; }  void dictionarySort(struct entry Sort[],int n) {     int i,j,k;     //struct entry temp[N];     struct entry temp;     i=0;     j=0;     for(i=0;i<n;i++)         while(Sort[i].word[j]!='\0')         {             if(Sort[i].word[j]>Sort[i+1].word[j])             {                 temp=Sort[i+1];                 Sort[i+1]=Sort[i];                 Sort[i]=temp;             }             else                 j++;         }     for(i=0;i<N;i++)         printf("%s %s",Sort[i].word,Sort[i].defination); }  供参考～  楼主的问题不止一个，建议对比代码找一下自己的问题。另外，测试一下吧，有问题再提出来～

user: user-0
content: 引用 1 楼 自信男孩 的回复:#include<stdio.h>  #define N       10  struct entry {     char word[15];     char defination[200]; };  void dictionarySort(struct entry Sort[],int n);  int main (void) {     //int N;     int i,j;     struct entry dictionary[N];     printf("please input the words' number do you want to entry.\n");     for(i=0;i<N;i++)     {         char c=getchar();         while(c!='\n')         {             //dictionary[i].word[j]=getchar();             dictionary[i].word[j]= c;             c = getchar();             j++;         }         dictionary[i].word[j] = 0;   //add '\0'     }     printf("Please input their defination.\n");     for(i=0;i<N;i++)     {         char c=getchar();         while(c!='\n')         {             //dictionary[i].defination[j]=getchar();             dictionary[i].defination[j]= c;             c = getchar();             j++;         }         dictionary[i].defination[j] = 0;    //add '\0'     }     dictionarySort(dictionary,N);      return 0; }  void dictionarySort(struct entry Sort[],int n) {     int i,j,k;     //struct entry temp[N];     struct entry temp;     i=0;     j=0;     for(i=0;i<n;i++)         while(Sort[i].word[j]!='\0')         {             if(Sort[i].word[j]>Sort[i+1].word[j])             {                 temp=Sort[i+1];                 Sort[i+1]=Sort[i];                 Sort[i]=temp;             }             else                 j++;         }     for(i=0;i<N;i++)         printf("%s %s",Sort[i].word,Sort[i].defination); }  供参考～  楼主的问题不止一个，建议对比代码找一下自己的问题。另外，测试一下吧，有问题再提出来～ 现在我可以输入了，只不过排序算法有问题，我再改改。

user: user-0
content: 引用 1 楼 自信男孩的回复:#include<stdio.h>  #define N       10  struct entry {     char word[15];     char defination[200]; };  void dictionarySort(struct entry Sort[],int n);  int main (void) {     //int N;     int i,j;     struct entry dictionary[N];     printf("please input the words' number do you want to entry.\n");     for(i=0;i<N;i++)     {         char c=getchar();         while(c!='\n')         {             //dictionary[i].word[j]=getchar();             dictionary[i].word[j]= c;             c = getchar();             j++;         }         dictionary[i].word[j] = 0;   //add '\0'         i++;     }     printf("Please input their defination.\n");     for(i=0;i<N;i++)     {         char c=getchar();         while(c!='\n')         {             //dictionary[i].defination[j]=getchar();             dictionary[i].defination[j]= c;             c = getchar();             j++;         }         dictionary[i].defination[j] = 0;    //add '\0'         i++;     }     dictionarySort(dictionary,N);      return 0; }  void dictionarySort(struct entry Sort[],int n) {     int i,j,k;     //struct entry temp[N];     struct entry temp;     i=0;     j=0;     for(i=0;i<n;i++)         while(Sort[i].word[j]!='\0')         {             if(Sort[i].word[j]>Sort[i+1].word[j])             {                 temp=Sort[i+1];                 Sort[i+1]=Sort[i];                 Sort[i]=temp;             }             else                 j++;         }     for(i=0;i<N;i++)         printf("%s %s",Sort[i].word,Sort[i].defination); }  供参考～  楼主的问题不止一个，建议对比代码找一下自己的问题。另外，测试一下吧，有问题再提出来～ 感谢