| 查看: 2693 | 回复: 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就没错了!真搞不懂了,望高手赐教! |
» 猜你喜欢
招博士
已经有6人回复
限项规定
已经有8人回复
国家基金申请书模板内插入图片不可调整大小?
已经有5人回复
交叉科学部支持青年基金,对三无青椒是个机会吗?
已经有3人回复
国家级人才课题组招收2026年入学博士
已经有5人回复
Fe3O4@SiO2合成
已经有6人回复
青年基金C终止
已经有4人回复
青椒八年已不青,大家都被折磨成啥样了?
已经有7人回复
为什么nbs上溴 没有产物点出现呢
已经有10人回复
救命帖
已经有11人回复

12楼2014-02-22 15:58:51
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













回复此楼