| 查看: 2706 | 回复: 12 | ||
| 当前只显示满足指定条件的回帖,点击这里查看本话题的所有回帖 | ||
[求助]
谭浩强C语言教材,P298页照着输入都不对!求原因
|
||
|
#include #include #define NULL 0 #define LEN sizeof(struct student) struct student { long num; float score; struct student *next; }; int n; struct student *creat(void) { struct student *head,*p1,*p2; n=0; p1=p2=(struct student *)malloc(LEN); scanf("%ld%f",&p1->num,&p1->score); head=NULL; while(p1->num!=0) { n++; if(n==1) head=p1; else p2->next=p1; p2=p1; p1=(struct student *)malloc(LEN); scanf("%ld%f",&p1->num,&p1->score); } p2->next=NULL; return head; } void main() { struct student *lin1=creat(); } //scanf("%ld%f",&p1->num,&p1->score);好像是这一句出错,但是将float score改成int score就不会出错了,下面的%f相应的改成%d就没错了!真搞不懂了,望高手赐教! |
» 猜你喜欢
基金正文30页指的是报告正文还是整个申请书
已经有3人回复
今年春晚有几个节目很不错,点赞!
已经有5人回复
球磨粉体时遇到了大的问题,请指教!
已经有15人回复
过年走亲戚时感受到了所开私家车的鄙视链
已经有5人回复
情人节自我反思:在爱情中有过遗憾吗?
已经有5人回复
江汉大学解明教授课题组招博士研究生/博士后
已经有3人回复


13楼2014-08-14 10:26:36
libralibra
至尊木虫 (著名写手)
骠骑将军
- 程序强帖: 40
- 应助: 817 (博后)
- 金币: 12914.1
- 红花: 64
- 帖子: 2238
- 在线: 287.3小时
- 虫号: 696514
- 注册: 2009-02-05
- 专业: 计算机软件

2楼2011-05-06 16:36:12
yalefield
金虫 (文坛精英)
老汉一枚
- 程序强帖: 3
- 应助: 129 (高中生)
- 贵宾: 0.17
- 金币: 21238.9
- 散金: 3440
- 红花: 66
- 帖子: 12101
- 在线: 759.1小时
- 虫号: 96063
- 注册: 2005-10-07
- 专业: 高等教育学
- 管辖: 计算模拟
3楼2011-05-06 22:37:45
holmescn
金虫 (正式写手)
- 程序强帖: 37
- 应助: 1 (幼儿园)
- 金币: 1918.8
- 散金: 275
- 红花: 1
- 帖子: 699
- 在线: 102.6小时
- 虫号: 913482
- 注册: 2009-11-26
- 性别: GG
- 专业: 凝聚态物性 II :电子结构
4楼2011-05-07 08:43:26













回复此楼