ImageVerifierCode 换一换
格式:DOCX , 页数:17 ,大小:91.09KB ,
资源ID:1662499      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/1662499.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(系统级编程作业 lab1解析.docx)为本站会员(b****1)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

系统级编程作业 lab1解析.docx

1、系统级编程作业 lab1解析System Level Programming Lab C+ fundamentals and Type conversion Student ID _1043111051_ Student Name 王金科_ _ Start Time 16:20星期二日 2012年09月4 Finish Time 23:55 星期日09月9日2012年1. Objectives: To write simple C+ programs covering: ? Understand how a character is stored in memory; ? Understand

2、 how an integer is stored in memory; ? Understand array and pointer; and ? Perform conversion from eight bits (character) to eight bytes to be displayed on screen. 2. Type and Format in memory character, integer, short and float 2.1 This exercise is to determine the memory size of different type. la

3、b1_1.cpp /Determine the memory size of declaration and variable type #include #include #include #include #include #include void main() char c; char s128; short i; short n64; printf(= =n, sizeof(c), sizeof(char); printf(= =n, sizeof(s), sizeof(char128); printf(= =n, sizeof(i), sizeof(short); printf(=

4、 =n, sizeof(n), sizeof(short64); The display is: 1 - - 2018/10/21 System Level Programming Lab Now execute the above program and fill in the following: Size in bit Size in byte Type 16 2 Short 8 1 Char 64 512 Short32 64 512 Char64 2.2 integer128, integer, float, the Use the approach of the above, de

5、termine memory size of float16 (lab1_2.cpp) ) Write a program to verify your answer and fill in the following: hint, use sizeof(Size in bit Type Size in byte 32 4 Int 32 4 Float 512 4096 Int128 512 64 Float16 Write down your codes below: #include #include #include #include #include #include void mai

6、n() int c; int s128; float I; float n16; printf(“=n”,sizeof(c),sizeof(int); printf(“=n”,sizeof(s),sizeof(int128); printf(“=n”,sizeof(i),sizeof(float); printf(“=n”,sizeof(n),sizeof(float16); Write down your expression amongst the difference in size between character, integer, float, short, char8, int

7、8, short8, float8 Character = 1 byte Integer = 4bytes Float = 4bytes Short = 2bytes Char8 = 8bytes Int 8 = 32bytes Short8 = 16bytes Float8 = 32bytes 2 - - 2018/10/21 System Level Programming Lab 2.3 This exercise is to display the decimal and octal values so that you know how it is stored in memory.

8、 lab1_3.cpp /Determine the memory size of declaration and variable type #include #include #include #include #include #include void main() for (char i = 30; i 41; +i) printf(i: dec=%d oct=%o n, i, i); the output is: well. unsigned as hex to the above programme display decimal, octal, and modify Now (

9、Hints: hex, %x, unsigned %u) Write down your codes below: #include #include #include #include 3 - - 2018/10/21 System Level Programming Lab #include #include void main() for(char i = 30; i 41;+i) printf(i: dec=%d oct=%o hex=%x unsigned=%u n, i, i,i,i); Write down the output of the first 4 lines so t

10、hat you understand the difference among them. i:dec=30 oct=36 hex=1e unsigned=30 i: dec=31 oct=37 hex=1f unsigned=31 i: dec=32 oct=40 hex=20 unsigned=32 i: dec=33 oct=41 hex=21 unsigned=33 2.4 This exercise is to dump the content of memory of different type so that you know how it is stored in memor

11、y. lab1_4.cpp /Determine the memory size of declaration and variable type #include #include #include #include #include #include void main() char a = 0; / in hex 0x30, not 0 int i = 0x00000013; /in decimal is (1 x 16 + 3) = 19 short j = 18; /occupies two bytes, float f = 1.25; /occupies 4 bytes In or

12、der to display, you have to set a break point by pressing “F9” beside the line, the program will display a red circle as follows: 4 - - 2018/10/21 System Level Programming Lab Now, type the address of each variable as shown in the left-bottom frame to locate whether . Since, visual C+ reserves 4 byt

13、es but they are. Here, we dump the address of variable a(means CC to three see byte, you can that the rest bytes are set CC CC one c char uses 10101010 10101010 10101010 in binary, the default setting). &a is 0x0065fdf4, you have to type 1memory location of athen in the Address, key in 0x0065fdf4, 2it displays 30 CC CC CC 3 0x0065FDF4, the hexadecimal is 0x30 (ASCII) 5 - - 2018/10/21 System Level Programming Lab Now, type and execute the above program and fill in the following, note th

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1