Part 32 – Double Variables

For a complete table of contents of all the lessons please click below as it will give you a brief of each lesson in addition to the topics it will cover. https://github.com/mytechnotalent/Reverse-Engineering-Tutorial

The next stage in our journey is that of double-precision floating-point variables.

A double-precision floating-point variable is different from a floating-point variable as it is 64-bits wide and 15-17 significant digits of precision.

Let’s examine our code.

  1. #include <iostream>
  2. int main(void) {
  3. double myNumber = 1337.77;
  4. std::cout << myNumber << std::endl;
  5. return 0;
  6. }

Part 32 – Double Variables - 图1

To compile this we simply type:

g++ example7.cpp -o example7

./example7

Part 32 – Double Variables - 图2

SUCCESS! We see 1337.77 printed to the standard output or terminal!

Let’s break it down:

We assign the floating-point variable directly into the variable myNumber and then print it out to the terminal with the c++ cout function.

Next week we will dive into Debugging Double Variables.