File Extensions in C++
Before we start writing code, it is worth mentioning that C++ source files can use different file extensions.
Common C++ file extensions include:
. cc . cpp . cxx
Enter fullscreen mode
Exit fullscreen mode
All three are valid for C++ source files.
In practice, .cpp and .cc are probably the most common ones. The .cxx extension is also valid, but you will usually see it less often.
For this example, let’s imagine we create a file called:
integers_floats.cpp
Integer Types in C++
An integer is a whole number without a fractional part.
Examples of integers are:
0 42 -10 100000
Enter fullscreen mode
Exit fullscreen mode
In C++, integers can be either:
signed unsigned
Enter fullscreen mode
Exit fullscreen mode
A signed integer can store both negative and positive values.
An unsigned integer can store only zero and positive values.
For example:
- 10 // signed 0 // signed or unsigned 42 // signed or unsigned
Enter fullscreen mode
Exit fullscreen mode
Fixed-Width…