MATH 269 All Units
MATH 269 All Units
E. Owusu – Ansah
Department of Mathematics
KNUST - Ghana
Think about some of the different ways that people use computers.
In school, students use computers for tasks such as
writing papers,
searching for articles,
sending email,
and participating in online classes.
At work, people use computers to
analyze data,
make presentations,
conduct business transactions,
communicate with customers and
coworkers, control machines in manufacturing
facilities, and many other things.
Figure : The value of 10011101 and the bit pattern for 157
When all of the bits in a byte are set to 0 (turned off), then the
value of the byte is 0.
When all of the bits in a byte are set to 1 (turned on), then the byte
holds the largest value that can be stored in it. Thus the largest
value 255 because there are only eight bits in a byte.
What if you need to store a number larger than 255? The answer
is simple: use more than one byte.
For example, suppose we put two bytes together. That gives us 16
bits, shown in Figure below, with a maximum value of 65,535.
The ASCII code is not the only computer code, but it is typical,
and it is used in most personal computers.
The Extended Binary Coded Decimal Interchange Code, or
EBCDIC, is an eightbit code that is used in IBM mainframe
computers. In these computers, the principle is the same–every
character is stored in a byte as a series of binary digits.
However, the actual values used are different. For example, in
EBCDIC, an A is 11000001, or 193.
Another code used by languages such as Java and C# is Unicode;
with this code, 16 bits are used to represent each character.
The character A in Unicode has the same decimal value as the
ASCII A, 65, but it is stored as 0000000001000001.
Using two bytes provides many more possible combinations than
using only eight bits – 65,536 to be exact. With Unicode, enough
codes are available to represent all English letters and digits, as
well as characters from many international alphabets
You can use the case structure when there are several distinct
possible values for a single variable, and each value requires a
different subsequent action.
When using the case structure, you compare a variable to a series
of test values, taking appropriate action when a match is found.
You use the case structure only when a series of decisions is
based on different values stored in a single variable