c3链表队列二叉树.doc

  1. 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
  2. 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  3. 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
c3链表队列二叉树 ? 结构和其他数据形式 关键字:struct,union,typedef 运算符:.- /*book.c--仅包含一本书的图书目录*/ #include stdio.h #define MAXTITL 41 #define MAXAUTL 31 struct book{//结构模板:标记为book char title[MAXTITL]; char author[MAXAUTL]; float value; };//结构模板结束 int main(void) { struct book library;//把library声明为book类型的变量 printf(Please enter the book title.\n); gets(library.title); printf(Now enter the author.\n); gets(library.author); printf(Now enter the value.\n); scanf(%f,library.value); printf(%s by%s:$%.2f\n,library.title,library.author,library.value); printf(%s:\%s\($%.2f)\n,library.author,library.title,library.value); printf(Done.\n); return 0; } -- 结构声明(structure declaration) struct book{ char title[MAXTITL]; char author[MAXAUTL]; float value; }; struct book dickens; struct book library; -- struct{/*无标记*/ char title[MAXTITL]; char author[MAXTITL]; float value; }library; gets(library.title); scanf(%f,library.value); struct book gift={.value=25.00, .author=James Broadfool, .title=Rue for the Toad}; --- 声明结构数组 struct book library[MAXBKS]; -- while(count MAXBKSgets(library[count].title)!=NULL library[count].title[0]!=[message]) -- struct names{//第一个结构 char first[LEN]; char last[LEN]; }; struct guy{//第二个结构 struct names handle;//嵌套结构 char favfood[LEN]; char job[LEN]; float income; }; printf(Hello,%s!\n,fellow.handle.first); --- 声明和初始化结构指针 struct guy*him; him=barney; him=fellow[0]; him-income is fellow[0].income if him==fellow[0] fellow[0].income==(*him).income barney.income==(*him).income==him-income//him==barney --- /*names.c--使用指向结构的指针*/ #include stdio.h #include string.h struct namect{ char fname[20]; char lname[20]; int letters; }; void getinfo(struct namect*); void makeinfo(struct namect*); void showinfo(const struct namect*); int main(void) { struct namect person; getinfo(person); makeinfo(person); showinfo(person); return 0; } void getinfo(struct namect*pst) { printf(Please enter your first name.\n); gets(pst-fname); printf(Please enter you last name.\n); gets(pst-lname); } void makeinfo(stru

文档评论(0)

shujukd + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档