2.10: The Bool Data Type & 2.11 Determine the size of a Data type

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

Expressions that have a true or false value are called ____________expressions, named in honor of English mathematician George Boole (1815-1864).

Boolean

Declare a variable hasPassedTest, and initialize it to true .

bool hasPassedTest=true;

Declare a variable isACustomer, suitable for representing a true or false value .

bool isACustomer;

Write a literal representing the false value in C++.

false

The ___________operator may be used to determine the size of a data type on any system A special operator called sizeof will report the number of bytes of memory used by any data type or variable. Program 2-18 illustrates its use. The first line that uses the operator is line 10: cout << "The size of an integer is " << sizeof(int); The name of the data type or variable is placed inside the parentheses that follow the operator. The operator "returns" the number of bytes used by that item. This operator can be invoked anywhere you can use an unsigned integer, including in mathematical operations.

sizeof

Write an expression whose value is the number of bytes that an int variable occupies on whatever machine the expression is executed on.

sizeof(int);

Write an expression whose value is the number of bytes that an unsigned long variable occupies on whatever machine the expression is executed on.

sizeof(long);

Write a literal representing the true value .

true


Kaugnay na mga set ng pag-aaral

Miller's Tale, Wife of Bath's Tale, and Pardoner's Tale Test

View Set

Interactive Presentation Chapter 3

View Set

Chapter 9: Nutrition and Hydration

View Set

Chapter 28: Managements of Patients With Structural, Infectious and Inflammatory Cardiac Disorders

View Set

fluid and electrolyte dynamic study

View Set

pharm psychology ati 41 questions

View Set

Biology Chapter 1 Study Test Questions

View Set