- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
Lesson 13 String Fundaments Outline: Multidimensional arrays (cont.) Sort From array of characters to String String-handling library Case Study: Input Data Validation: isanum() Character and Word Counting #define NUMROWS 3 #define NUMCOLS 4 int val[NUMROWS][NUMCOLS] Element direct access by offset Pass multi-dimensional array as parameter Case study: #define NUMSTD 123 #define NUMCOR 4 int score[NUMSTD][NUMCOR]; Two functions: 1. Find and return the maximum average score. 2. Find and return the average score and standard deviation for each course Program design Selection sort, Sorting by selection At every pass, select the item of the smallest value in the unsorted sequence, exchange it with the 1st position unsorted, and then mark it sorted Selection sort example Index A[0] A[1] A[2] A[3] A[4] A[5] Original 34 8 64 51 32 21 after pass 1 8 34 64 51 32 21 afetr pass 2 8 21 64 51 32 34 after pass 3 8 21 32 51 64 34 afetr pass 4 8 21 32 34 64 51 after pass 5 8 21 32 34 51 64 Sorted 8 21 32 34 51 64 selection sort Bubble Sort Sorting by exchange compare all the adjacent pairs, exchange them if they are out of order Items with large keys tend to move to right; the largest key will “bubble up” to last Bubble sort example Index A[0] A[1] A[2] A[3] A[4] A[5] Original 14 18 11 8 56 34 after pass 1 14 11 8 18 34 56 afetr pass 2 11 8 14 18 34 56 after pass 3 8 11 14 18 34 56 afetr pass 4 8 11 14 18 34 56 after pass 5 8 11 14 18 34 56 Sorted 8 11 14 18 34 56 Bubble sort String —— sequence of chars end with ‘\0’ String in written form: Good Morning! Also called: string constant, string value, string String —— in array of char Can be stored in an array of characters terminated by an end-of-string character NULL (\0) starting from the beginning of the array end up with the first ‘\0’ String —— operation gets(); puts(); String operation—— use string.h
您可能关注的文档
最近下载
- 【人教七年级上册数学情境课堂课件】 3.1.3 反比例关系 课件.pptx VIP
- Juniper路由器配置操作手册.docx VIP
- 设备动力部岗位说明书仪表工程师.pdf VIP
- 泳乐游泳馆商业计划书.pptx VIP
- 2025年全国大学生职业生涯规划大赛获奖作品鉴赏 .pdf VIP
- 放射科2025年工作总结及2025年工作计划.docx VIP
- 超星尔雅学习通《如何高效学习》章节测试答案.docx VIP
- 2023年中考语文小说阅读考点精讲精练 考点01 修辞手法(含详解).docx VIP
- 超星尔雅 学习通《如何高效学习》章节测试答案.pdf VIP
- 《有线通信系统》全套教学课件.pptx
原创力文档


文档评论(0)