bugl
bugl
HomeLearnPatternsPathsSearch
HomeLearnPatternsPathsSearch

Loading lesson path

Learn/C++/C++ Tutorial
C++•C++ Tutorial

C++ Data Types

Flash cards

Review the key moves

1/4
Core idea

What is the main idea behind C++ Data Types?

Lesson checks

Practice each idea before moving on

Short Mimo-style checks built from this lesson's code, terms, and sequence.

1Quick choice

Which statement best captures the main point of this lesson?

2Fill blank

Complete the missing token from the example code.

___ myNum = 5;
3Order

Put the learning moves in the order that makes the concept easiest to apply.

You will learn more about the individual data types in the next chapters.
The data type specifies the size and type of information the variable will store:
As explained in the Variables chapter, a variable in C++ must be a specified data type:

As explained in the Variables chapter, a variable in C++ must be a specified data type:

int myNum = 5;
// Integer (whole number) float myFloatNum = 5.99; // Floating point number double myDoubleNum = 9.98; // Floating point number char myLetter = 'D'; // Character bool myBoolean = true; // Boolean string myText = "Hello"; // String

Basic Data Types

The data type specifies the size and type of information the variable will store:

Data TypeSizeDescription
bool1 byteStores true or false values
char1 byteStores a single character/letter/number, or ASCII values
int2 or 4 bytesStores whole numbers, without decimals
float4 bytesStores fractional numbers, containing one or more decimals. Sufficient for storing 6-7 decimal digits
double8 bytesStores fractional numbers, containing one or more decimals. Sufficient for storing 15 decimal digits

You will learn more about the individual data types in the next chapters.

Previous

C++ User Input

Next

C++ Numeric Data Types