Mastery 9: Basic types and their use in C++

Ok so… for these mastery I did some research .. because I didnt knew what a «basic type» was in c++… so here is what i found:

Fundamental data types are basic types implemented directly by the language that represent the basic storage units supported natively by most systems.

They can mainly be classified into:

  • Character types: They can represent a single character, such as 'A' or '$'. The most basic type is char, which is a one-byte character.
  • Integer types: They can store a whole number value, such as 7 or 1024. They exist in a variety of sizes, and can either be signed or unsigned, depending on whether they support negative values or not.
  • Floating-point types: They can represent real values, such as 3.14 or 0.01. (We have only seen double, but alse exist float)
  • Boolean type: The boolean type, known in C++ as bool, can only represent one of two states, true or false. (THESE WE HAVE NOT SEEN IT)
  • Where i found these info http://www.cplusplus.com/doc/tutorial/variables/…

So lets see each one of them closely..

1.- A char type: they always must be inside »… and they can be any «character» you want:

2.-A int type: these is usefull when the value you are assigning is a integer number, no need of any special character.

3.Floating point type: these is usefull when the value you are assigning is a decimal point.

  • Red arrow: assigning a diferent types to each variable
  • Yellow arrow: asigning each variable a different value (depending on their type)
  • Green arrow: The final result.

9

masterr


Deja un comentario