// archives

Variable and Data Types

This category contains 14 posts

Representing a Double-Word

(Image-1)

A double-word (Image-1)

Is a group of two consecutive Words
A double-word combines 4 bytes, or 8 nibbles, or 32 bits

The bits

Counted from right to left, start at 0 and end at 31 (Image-1)

(Image-2)
 

Considered as a group of 32 bits (Image-2)

The most right bit, bit 0, is called the Low Order bit or LO bit or LOBIT
The [...]

Practical Learning: Using Short Integer Variables

1. Start your programming environment and create a new project named ABCCS1.
Depending on your environment, if the file was not created already, then create a source file and save it as, or name it exercise.cpp

2. Set the file’s content as follows (A-1):

Example of (A-1)

#include <iostream>
 
using namespace std;
 
int main()
 
{
 
unsigned short shirts;
 
unsigned short pants;
 
unsigned short dresses;
 
unsigned short [...]

Short Integers

A word

Which is a group of 16 contiguous bits or 2 bytes, is used to represent a natural number
As we have studied, the maximum numeric value that can fit in a word is 65535
Since the Byte is used only to represent a character, whenever you plan to use a number in your program, the minimum [...]

Representing a Word

(Image-1)

A word

Is a group of 16 consecutive bits

The bits

Are counted from right to left starting at 0 (Image-1):

Considered as a group of 16 bits (Image-1)

The most right bit of a word, bit 0, is called the least significant bit or Low Order bit or LO bit or LOBIT
The most left bit, bit 15, is called [...]

Escape Sequences

When you use alphabetic characters in your program

The compiler considers them as numbers but converts each to its corresponding character following the ASCII list

Counting decimal values starting at 0, the first 32 characters actually do not display anything on the screen:

They are called non-printing characters

They are obtained from pressing Ctrl and an alphabetic letter or [...]

Character Variables

A byte

Is used to hold a single character

A character

Is an individual symbol that displays on your screen
It could be (B-1)

Example of (B-1)

A lowercase letter: a, b, c, d, e, f, g, h, I, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, and z
An uppercase letter: A, B, [...]

Representing a Byte

(Image-1) Byte
 

A byte

Is a group of eight consecutive bits (Image-1)
The bits are counted from right to left starting at 0
Is considered as being made of two nibbles (Image-2)

 The most right bit

Is bit 0
It is called the least significant bit
It is also referred to as the Low Order bit, the LO bit, or LOBIT

The most left [...]

Combinations of Bits Using the Boxes

Combinations of bits using the boxes (Image-1)

Binary combinations: 0000, 0001, 0010, 0011, 0100, 0101, 0110, 0111, 1000, 1001, 1010, 1011, 1100, 1101, 1110, 1111 = 16 combinations

This could be expressed in decimal value as 24 which is 16

2 represents the fact that there are two possible states: 0 and 1
4 represents the fact that [...]

The Four-Bit Combination

(Image-1) Nibble

Nibble

Is represented by a group of 4 bits = 1/2 byte
This is also a system that the computer uses to count bits internally

The first bit, on the right side of the nibble

Is called the Low Order bit or LO bit
This is also called the least significant bit
The bit on the right side is counted [...]

A Bit

The computer (or an Intel computer, or a computer that runs on an Intel microprocessor)  

(B-1) Uses the binary system to represent its information

Example of (B-1)

A piece of information in the computer is called a datum
(B-2) The plural is data

Example of (B-2)

Sometimes, the word data is used for both singular and plural

The computer represents data

Using [...]