You are on page 1of 2

4/1/2017 Other Data Types | Available Data Types | DEV210x Courseware | edX

Microsoft: DEV210x Introduction to C++ Help

Module 2 Data Types in C++ > Available Data Types > Other Data Types

Bookmarks
Other Data Types
 Bookmark this page
 Module 0

C++ supports other data types outside of the numeric or character data
 Module 1
types.  The first one we see in the table below, is the Boolean data type
Introducing
called bool.  This is used to represent true or false values in an
C++
application.  In previous languages such as C, false was represented as a
0 value and true was represented as any non-zero value.
 Module 2
Data Types in
C++ Type Name Bytes Alias Range

Available Data bool 1 none true or false


Types
Self-Check  enum varies none dependant on the enclosed data types

Variables and
Constants C++ also has the concept of an enumeration, called an enum.  An

Self-Check enumeration is a set of constants stored as literal values.  They limit the
Complex Data choices for the type.  For example, when dealing with an int data type,
Types you can assign any value to that data type that fits within the range of
Self-Check 
the integer type for that computer.  With an enum, you specify a limited
Peer Review set of literal constants that can be assigned to the type. 
Homework 

Consider the need to use a data type to represent days of the week. 
 Module 3 How do you store this information in a data type?  You could use an
Control array, but what type of data would you use?  Perhaps a string data type. 
Statements But how do you prevent someone from adding a non-valid day of the
week, like moncleday, to the array?  If you create an enumeration that
 Module 4 stores only valid values for Sunday through Saturday, you constrain the
Functions and data type to those literal constants only.
Objects
Enumerations are covered later in this module under the lesson on
 End of Course Complex Data Types.
Evaluation

© All Rights Reserved

https://courses.edx.org/courses/course­v1:Microsoft+DEV210x+2T2017/courseware/ec46a4a428a944a4b8cbe9010af4af97/7a6776e7c1d242228fd3619792f8c49a… 1/2
4/1/2017 Other Data Types | Available Data Types | DEV210x Courseware | edX

© 2012-2017 edX Inc. All rights reserved except where noted. EdX, Open edX and the edX and Open EdX logos
are registered trademarks or trademarks of edX Inc.

     

https://courses.edx.org/courses/course­v1:Microsoft+DEV210x+2T2017/courseware/ec46a4a428a944a4b8cbe9010af4af97/7a6776e7c1d242228fd3619792f8c49a… 2/2

You might also like