| 查看: 3209 | 回复: 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就没错了!真搞不懂了,望高手赐教! |
» 猜你喜欢
售SCI一区T0P文章,我:8.O.55.1.O54,科目全,可伽急
已经有5人回复
售SCI一区T0P文章,我:8O.55.1.O.54,科目全,可伽急
已经有11人回复
科研人应该花精力去思考如何解决问题,而不是去凝练问题
已经有16人回复
初秋的晨风
已经有3人回复
面上没中,邀请各位路过的虫友分析一下分数
已经有11人回复
Ei源刊怎么投
已经有4人回复
广西大学-广州大学招聘博士后 欢迎广大优秀人才!!!
已经有6人回复
两块石头
已经有5人回复
哈尔滨工业大学韩晓军教授课题组招收2027年硕士推免生及博士研究生
已经有3人回复
找导师
已经有8人回复

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










回复此楼