Unit 04 Test 2 - UNIT4/REVIEW1TEST 1. a Whatdoes#definedo b...

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

View Full Document Right Arrow Icon
UNIT 4/REVIEW 1 TEST 1. Briefly answer each of the following questions. a. What does #define do? b. What is Hungarian Notation? c. What is the difference between = and ==? d. What is the difference between a float and a double? e. What is a namespace? a) #define tell the computer to go through the code, before compiling and replace anything that is being  defined. i.e. " #define PI 3.1415 " Computer will replace all PI's with 3.1415. b) Hungarian Notation helps you keep your defined id unique from all the predefine id's in the C++. E.g.  float fArea = 0.0; “fArea” is Hungarian Notation.  c) = is an assignment operator, i.e. b=1, it sets b variable equals to 1. And == is an equality operator, it  checks if the left side of == is equal to right side. d) Float has a precision of 7 digits, where as double has precision of 15 units. For more accurate results,  we should use double.  e) namespace helps computer not to get confused with anyone else's code, because they are using the  common commands like cout, endl. If you dont use namespace then you will have declare every line with  commands like cout and endl with its namespace. 
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/02/2011 for the course ME 205 taught by Professor Koen during the Spring '07 term at University of Texas.

Page1 / 4

Unit 04 Test 2 - UNIT4/REVIEW1TEST 1. a Whatdoes#definedo b...

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

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