当前位置: 代码迷 >> C语言 >> 看看哪里有错误??
  详细解决方案

看看哪里有错误??

热度:145   发布时间:2007-08-11 16:09:34.0
看看哪里有错误??

/* Note:Your choice is C IDE */
#include "stdio.h"
#define MAX 10
#define Y 1
#define N 0
struct birth {
int year;
int month;
int day;
};


struct stu {
char name[10] ;
long num;
char add[20];
struct birth mybirth;
}student [MAX];


int count = 0, m;

void arr_stu ( struct stu *p_stu , int length );

main()
{ int choice=1;
printf ("please input the infomation about students\n\n");

for (; count < MAX && choice == 1 ; count ++)

{
printf ("\n\n\n\n\ninput the %d student information", count+1);
printf ("\n\n\ninput the name >>");
scanf ("%s",student[count].name);
printf ("\ninput the num >>");
scanf ("%ld",&student[count].num);
printf ("\ninput the birthday ( for example : 1945,4,6) >>");
scanf ("%d,%d,%d",&student[count].mybirth.year , &student[count].mybirth.month , &student[count].mybirth.day );
printf ("\n\n contiue or exit\? (1 means continu ; 0 means exit)");
scanf ("%d",&choice);
m = count;

}

arr_stu ( student , MAX );

printf ("\n\n\n\n");

for (count=0; count <= m ; count ++ )

printf ( "The %d student's name is %s ,num is %ld\n",count+1 , student[count].name, student[count].num);


}


void arr_stu (struct stu *p_stu , int length )

{
struct stu change;
int i=0,j;
for (; i<=m-1 ;i++)
{
for (j=i+1;j<=m;j++)
{
if ( p_stu[i].num > p_stu[j].num)

{ change = p_stu [i];
p_stu[i] = p_stu[j];
p_stu [j] = change;
}
}
}

}


----------------解决方案--------------------------------------------------------

编译通过的。


----------------解决方案--------------------------------------------------------

不知道你说的是什么错误,程序可以运行


----------------解决方案--------------------------------------------------------

我这怎么不好运行啊??~~

大哥帮忙哈!!

飞燕姐呢~~~

快来急救~~


----------------解决方案--------------------------------------------------------
  相关解决方案