Wednesday, May 21, 2008

int, char, and bool data type

The integral data type that I will be discussing are int, char, and bool.
  • int data type
    • Integers in C++, as in mathematics, are numbers such as the following:
      -88, 2006, +89, -3005, 3105
    • In addition, positive integers do not need a + sign in front of them and no commas are used within an integer. In C++, commas are used to separate items in a list. So, 3, 105 would be interpreted as two integers: 3 and 105.
  • char data type
    • The smallest integral data type(dealing with small numbers-ranging from -128 to 127)
    • Used to represent characters-that is, letters, digits, and special symbols(thus, it can represent every key on your keyboard)
    • When you are using the char data type, each character is enclosed within a single quotation marks.(! a blank space is a character and is written as ' ', with a space between the single quotation marks)
    • Allows only one symbol to be placed between the single quotation marks.(! all the individual symbols located on the keyboard that are printable may be considered as possible values of the char data type.)
  • bool data type
    • It has only two values: true and false.
    • The central purporse of this data type is to manipulate logical(Boolean) expressions.(true and false is the logical(Boolean) expressions stated.)

No comments: