| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 630 人关注过本帖
标题:求助,帮编程序啊!
只看楼主 加入收藏
sailer
Rank: 1
等 级:新手上路
帖 子:69
专家分:0
注 册:2005-10-12
收藏
 问题点数:0 回复次数:4 
求助,帮编程序啊!
编写一个程序,该程序要求用户输入捐献者数目,然后要求用户输入每一个捐献者的姓名和款项。这些信息被储存在一个动态分配的结构数组中,每个结构有两个成员:用来储存性命的字符数组和用来存储款项的double成员。读取所有数据后,程序将显示所有捐献者姓名和捐款数目,如果没有捐献者名称,则程序将打印none
搜索更多相关主题的帖子: 编程序 
2005-10-24 23:20
wangjisea
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2004-12-6
收藏
得分:0 

#include <iostream.h>

typedef struct Object { char username[20]; double number; struct Object * next;

} NODE,*LPNODE;

int main(int argc, char* argv[]) { int number; LPNODE head=NULL,current=NULL,end=NULL; cout<<"Please input the number of records: "; cin>>number; for(int i=0;i<number;i++) { current=new NODE; current->next=NULL; cout<<"Please input the name of record "<<i+1<<" :"; cin>>current->username; cout<<"Please input the number of record "<<i+1<<" :"; cin>>current->number; if(head==NULL) { head=current; end=current; continue; } end->next=current; end=current; } for(current=head;current;current=current->next) { cout<<"The name is :"<<current->username<<"\n"; cout<<"The number is :"<<current->number<<"\n"; } return 0; }

2005-10-25 09:52
zinking
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:35
帖 子:916
专家分:0
注 册:2004-12-5
收藏
得分:0 
提醒一下,参考别人的程序,自己加以改进是最佳的学习方式

http://kongfuziandlife. http://codeanddesign.
2005-10-25 14:50
sailer
Rank: 1
等 级:新手上路
帖 子:69
专家分:0
注 册:2005-10-12
收藏
得分:0 
谢了啊,但请再指教一下
编写这个程序用到链表的知识吧,这个我不是很懂,也不会用啊。
在哪个学科上学啊,我学的C上面只是简单的介绍了一下啊。

希望大家多多配合他人,多多帮助他人。 支持国家的 产品,尽量不买外国货。
2005-10-25 17:41
zinking
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:35
帖 子:916
专家分:0
注 册:2004-12-5
收藏
得分:0 
链表请参考数据结构的书籍,
也不是很难理解的

http://kongfuziandlife. http://codeanddesign.
2005-10-25 21:46
快速回复:求助,帮编程序啊!
数据加载中...
 
   



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

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