系统级编程-lab4.docxVIP

  1. 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
  2. 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  3. 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
  4. 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
  5. 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们
  6. 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
  7. 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
系统级编程-lab4

Practice 1: ArrayStorage.cpp①将字符数组a与b的首地址传入Initialize?()方法后,对a中的各个元素进行赋值,将字符数组a的0到8位赋值为字符数组“This is A”。②又将a的首地址赋值给b的首地址,则在此时,b已经变为指向字符数组a的指针,与a等效。则b[8] = ‘B’就是将“This is A”改为“This is B”,未对字符数组b进行任何操作。③所以当Initialize?()方法运行结束后,字符数组a的内容为“This is A”,而字符数组b的内容仍为空。Practice 2: strchr.cppFgets();fgets()用来从参数stream 所指的文件内读入字符并存到参数s 所指的内存空间, 直到出现换行字符、读到文件尾或是已读了size-1 个字符为止, 最后会加上NULL 作为字符串结束.Strchr();用来查找某字符在字符串中首次出现的位置,其原型为: char * strchr (const char *str, int c);【参数】str 为要查找的字符串,c 为要查找的字符。strchr() 将会找出 str 字符串中第一次出现的字符 c 的地址,然后将该地址返回。Strncmp();strncmp() 用来比较两个字符串的前n个字符,区分大小写,其原型为: int strncmp ( const char * str1, const char * str2, size_t n );【参数】str1, str2 为需要比较的两个字符串,n为要比较的字符的数目。字符串大小的比较是以ASCII 码表上的顺序来决定,此顺序亦为字符的值。strncmp()首先将s1 第一个字符值减去s2 第一个字符值,若差值为0 则再继续比较下个字符,直到字符结束标志\0,若差值不为0,则将差值返回。例如字符串Ac和ba比较则会返回字符A(65)和b(98)的差值(-33)。Practice 3: Decoding Lab: Understanding a Secret MessageDecoding Lab (Part 1)Objectives: For this exercise, you have to compile a program as attached and supply four secret keys to determine the contents. In this laboratory, you have to supply the first two. The remaining will be done next week. I will guide you to solve the problem. This exercise is extracted from the CTE, SSD6 – Exercise one.The details are as follows.Start the program:invoke the visual C++ and use new to start the workplace.Select the New Menu and click “workplace”. The name is called exercise 1The project is exercise 1: Select Win32 ConsoleThe output after selecting the project is as follows. Select the empty button until you see the following screenNow Select New again and then Files, type the name of file “Exercise 1” and select C++ source file. Click the fileview and the source files you will see exercise1.cpp is there, but is empty.Now you download the secret file (secret.cpp) from CTE web site or get it from appendix.Compile the program without any bug. Set a breakpoint: Set a break point to force the program to break, press F9. A good programmer must know how to debug.Press F

文档评论(0)

yan698698 + 关注
实名认证
文档贡献者

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

1亿VIP精品文档

相关文档