plugin-lab04

plugin-lab04 - CS 2150 Laboratory 4 Number Representation...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
CS 2150 Laboratory 4 Number Representation Week of September 21, 2009 Objective: To become familiar with the underlying representation of various data types, and to learn how to examine these representations in the debugger. Background: In class we discussed how various data types – integers, characters, and floating point numbers were represented in computers. In this lab we will use the debugger to examine some of these representations. Reading(s): 1. Weiss C++ for Java Programmers Section 11.6, pages 224-225, on C++ Primitive arrays. 2. If you are a bit confused about unions, you might want to read about them prior to the in-lab. Do a Google search for ‘C++ unions’.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
CS 2150, fall 2009 Page 2 of 11 Procedure Pre-lab 1. Read Weiss C++ for Java Programmers Section 11.6, pages 224-225, on C++ primitive arrays, and the reading on unions described on the cover page. 2. Complete the Unix tutorial found in the Collab workspace (in the “03-more-unix” directory) – start at the ‘index.html’ page. The first half of this tutorial was covered in lab 3. 3. Write the sizeOf() function (note the capitalization), as described in the pre-lab section. 4. Write the outputBinary() function, as described in the pre-lab section. 5. Write the overflow() function, as described in the pre-lab section. 6. Combine these functions into a prelab4.cpp file, as described in the pre-lab section. 7. Complete your floating point conversion, as described in the pre-lab section, into a Word file called floatingpoint.doc. 8. Files to download: none 9. Files to submit: prelab4.cpp, floatingpoint.doc In-lab 1. Work through the steps one a time. Be sure that you understand what is happening at each step. 2. The three parts of the in-lab have you editing inlab.doc or inlab4.cpp or both. o Size of C++ data types o Representations in memory o Primitive arrays in C++ 3. Files to download: inlab4.doc 4. Files to submit: inlab4.doc, inlab4.cpp Post-lab 1. Write the recursive bit counter, in bitCounter,cpp, as described in the post-lab section. 2. Complete the radix worksheet – this worksheet is in the radixWorksheet.doc file in Collab. This will need to be submitted through Collab. 3. Files to download: radixWorksheet.doc 4. Files to submit: bitCounter.cpp, radixWorksheet.doc
Background image of page 2
CS 2150, fall 2009 Page 3 of 11 Pre-lab Reading You should read Weiss C++ for Java Programmers Section 11.6, pages 224-225, on C++ Primitive arrays – that will be needed in the in-lab. Also, the reading on unions described on the front cover of this lab. sizeOf() The size of C++ data types is dependent on the underlying hardware on which you are running. A programmer may determine the size of various data types by using the sizeof() operator. Although it looks like a function, it’s a language construct – like while() or if() – so it’s technically an operator. sizeof() returns the size, in bytes, of a given variable or data type. Note that you can use sizeof() with types, variables, pointers, classes, and objects.
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 11

plugin-lab04 - CS 2150 Laboratory 4 Number Representation...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online