| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 580 人关注过本帖
标题:链表中的floating point...错误-HELP
只看楼主 加入收藏
小咪
Rank: 1
等 级:新手上路
帖 子:37
专家分:0
注 册:2006-3-11
收藏
 问题点数:0 回复次数:3 
链表中的floating point...错误-HELP

刚学链表,很郁闷,错误为:scanf : floating point formats not linked
Abnormal program terminate
请大家关照,万分感激: 下面是程序

#include <malloc.h>
#define len sizeof(struct Node)
struct Node{
int M;
float N;
struct Node *next;
};

struct Node *Create(int n){
struct Node *h,*p;
int i;
h=(struct Node*)malloc(len);
h->next=0;
for(i=1;i<=n;i++)
{
p=(struct Node*)malloc(len);
printf("Node.M=");
scanf("%d",&p->M);
printf("Node.N=");
scanf("%f",&p->N);
printf("/n");
p->next=h->next;
h->next=p->next;
}
return h;
}

void print(struct Node* h){
struct Node *p;
p=h->next;
if(!p) printf("The Node list Is Empty!!");
else { printf("The Node list are:\n");
while(p){
printf("Node_M: %d : Node_N: %f ;\n",p->M,p->N);
p=p->next;
}
}
}
main()
{
int n;
struct Node *h;
printf("Input the Number of the NodeTree You want to Create:\n");
scanf("%d",&n);
h=Create(n);
print(h);
}

搜索更多相关主题的帖子: 链表 point floating HELP 
2006-03-11 15:58
Knocker
Rank: 8Rank: 8
等 级:贵宾
威 望:47
帖 子:10454
专家分:603
注 册:2004-6-1
收藏
得分:0 

九洲方除百尺冰,映秀又遭蛮牛耕。汽笛嘶鸣国旗半,哀伤尽处是重生。     -老K
治国就是治吏。礼义廉耻,国之四维。四维不张,国之不国。   -毛泽东
2006-03-11 16:16
神vLinux飘飘
Rank: 13Rank: 13Rank: 13Rank: 13
来 自:浙江杭州
等 级:贵宾
威 望:91
帖 子:6140
专家分:217
注 册:2004-7-17
收藏
得分:0 
晕,你老是推销你的作品

淘宝杜琨
2006-03-11 17:18
小咪
Rank: 1
等 级:新手上路
帖 子:37
专家分:0
注 册:2006-3-11
收藏
得分:0 
好东西,很实用,非常感谢。
2006-03-11 18:29
快速回复:链表中的floating point...错误-HELP
数据加载中...
 
   



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

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