| 查看: 2621 | 回复: 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就没错了!真搞不懂了,望高手赐教! |
» 收录本帖的淘帖专辑推荐
编程 |
» 猜你喜欢
论文终于录用啦!满足毕业条件了
已经有17人回复
不自信的我
已经有5人回复
磺酰氟产物,毕不了业了!
已经有4人回复
投稿Elsevier的杂志(返修),总是在选择OA和subscription界面被踢皮球
已经有8人回复
» 本主题相关价值贴推荐,对您同样有帮助:
谭浩强 C语言程序设计 word版本
已经有51人回复
关于Runtime问题。
已经有6人回复
C语言程序设计教程电子教案
已经有21人回复
不看后悔。。谭浩强C程序设计全套ppt
已经有165人回复
c语言求助,一个小程序详细讲解
已经有13人回复
谭浩强C语言程序设计PDF版
已经有44人回复
【课件】 谭浩强经典C++
已经有89人回复
【分享】谭浩强C++教材例题程序+课后习题答案 希望对大家有帮助!谢谢!
已经有20人回复
【分享】谭浩强C语言教程讲义,强烈推荐
已经有19人回复
【分享】谭浩强C语言word版
已经有215人回复

yalefield
金虫 (文坛精英)
老汉一枚
- 程序强帖: 3
- 应助: 129 (高中生)
- 贵宾: 0.17
- 金币: 21238.9
- 散金: 3440
- 红花: 66
- 帖子: 12101
- 在线: 759.1小时
- 虫号: 96063
- 注册: 2005-10-07
- 专业: 高等教育学
- 管辖: 计算模拟
3楼2011-05-06 22:37:45







回复此楼