| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 337 人关注过本帖
标题:看看哪里有错误??
只看楼主 加入收藏
Biglon
Rank: 1
等 级:新手上路
帖 子:20
专家分:0
注 册:2007-8-2
收藏
 问题点数:0 回复次数:3 
看看哪里有错误??

/* 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;
}
}
}

}

2007-08-11 16:09
chen7806
Rank: 1
等 级:新手上路
威 望:2
帖 子:160
专家分:0
注 册:2007-8-5
收藏
得分:0 

编译通过的。

2007-08-11 16:17
liulanghan
Rank: 1
等 级:禁止访问
帖 子:104
专家分:0
注 册:2007-5-5
收藏
得分:0 

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

2007-08-11 18:44
Biglon
Rank: 1
等 级:新手上路
帖 子:20
专家分:0
注 册:2007-8-2
收藏
得分:0 

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

大哥帮忙哈!!

飞燕姐呢~~~

快来急救~~

2007-08-11 19:34
快速回复:看看哪里有错误??
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.020048 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved