feierin365的专栏
登录
注册
空间
博客
好友
相册
留言
feierin365的空间
feierin365
长沙
共
35
次访问,排名
46308
好友
2
人,关注者
1
人
比较喜欢JAVA
注册时间:2007-10-15
登录时间:2008-6-29
[加为好友]
[即时聊天]
[发私信]
feierin365的个人资料
所在行业:
计算机软件
社区头衔:
个人专长:
java
专家分:
目前总共有0分
博客:
目前总共有1条评论
访问量:32
排名:20000名之外
文章数:2条
feierin365的好友
ccgo
mycsxy
查看全部好友的状态
/
共2好友
feierin365最新动态
06月
29
feierin365 下载了资源
ORACLE
15:36
feierin365 下载了资源
eclipse3.2 lomboz插件
15:12
06月
03
feierin365 下载了资源
weblogic 10 破解
10:43
05月
28
feierin365 下载了资源
学生学籍管理系统
08:57
feierin365 下载了资源
ATM自动取款机模拟系统
08:53
feierin365 下载了资源
C++编程思想源代码
08:50
05月
10
feierin365 下载了资源
[最新CCNA学习指南].Sybex.CCNA.Study.Guide.6th.Edit
22:12
05月
07
feierin365 下载了资源
程序员、网络管理员考试资料
13:33
04月
23
feierin365 收藏了网摘
Linux系统管理技术手册(中文第二版) - 免费试读 - boo
07:31
feierin365 收藏了网摘
C语言入门经典(第4版) - 免费试读 - book.csdn.net
06:54
04月
18
feierin365 发表了文章
Windows中所有系统文件的说明
04:16
feierin365 发表了文章
快速计算子网掩码的2种方法
04:14
feierin365 下载了资源
C、C 、Java、软件测试的笔试、面试题集合Version3
03:21
feierin365 下载了资源
.net Sundy新闻系统
03:17
feierin365 与
ccgo
成为了好友
03:15
04月
16
feierin365 与
mycsxy
成为了好友
18:43
feierin365 上传了资源
2008年网管员考试模拟题4(附答案)
18:38
feierin365 上传了资源
2008年网管员考试模拟题3(附答案)
18:37
feierin365 上传了资源
2008年网管员考试模拟题2(附答案)
18:37
feierin365 上传了资源
2008年网管员考试模拟题1(附答案)
18:36
feierin365的留言
frydsh
发表于:2007-12-04
#include "stdio.h"
#include "stdlib.h"
#define null 0
struct node//数据节点
{
int num;
struct node *next;//指向下一个数据节点
};
struct head//管理一个数据链的头节点
{
struct node *next;//指向数据链的第一个节点
struct node *last;//指向数据链的最后一个节点
};
void main()
{
struct head *copyp(int new_nth,int number,struct node *p);//将数number插入到指针p指向的一列数中,排第new_nth,代码在最后,此函数经检验运行正确.
struct node *a,*b;
a=(struct node *)malloc(sizeof(struct node));
a->num=1;
a->next=null;
b=(struct node *)malloc(sizeof(struct node));
b->num=2;
b->next=a;//把a,b作为一组连起来,b在前面
struct head s;
struct node *p;
s.next=(copyp(1,7,b))->next;
s.last=(copyp(1,7,b))->last;
s.last->next=(copyp(2,7,b))->next;
s.last=(copyp(2,7,b))->last;
s.last->next=(copyp(3,7,b))->next;
s.last=(copyp(3,7,b))->last;
p=s.next;
int e=0;
do//3个数一行的输出数据
{
printf("%d ",p->num);
e ;
if(e%3==0)
printf("\n");
p=p->next;
}
while(p!=null);
}
struct head *copyp(int new_nth,int number,struct node *p)//将数number插入到一列数中,排第new_nth.
{
struct head *head_a;
head_a=(struct head *)malloc(sizeof(struct head));
head_a->last=null;
head_a->next=null;
struct node *xp;
struct node *new_node;
new_node=(struct node *)malloc(sizeof(struct node));
new_node->num=number;
new_node->next=null;
int k=0;
while(p!=null)
{
if(k==0)
{
if(new_nth==1)
{
head_a->next=new_node;
head_a->last=new_node;
k ;
}
else
{
xp=(struct node *)malloc(sizeof(struct node));
xp->num=p->num;
xp->next=null;
head_a->next=xp;
head_a->last=xp;
p=p->next;
k ;
}
}
else
{
if(k!=new_nth-1)
{
xp=(struct node *)malloc(sizeof(struct node));
xp->num=p->num;
xp->next=null;
(head_a->last)->next=xp;
head_a->last=xp;
p=p->next;
k ;
}
else
{
(head_a->last)->next=new_node;
head_a->last=new_node;
k ;
}
}
}
return head_a;
}
/*我想看到的结果是7 2 1
2 7 1
2 1 7
此程序按理应该输出3行数,但是却只有一行7 2 1,不知道是怎么回事 求达人解决*/
给feierin365的留言