# Lab Program 4 - Binary, hex, decimal, ASCII & a function

Lab Program 4 - Binary, hex, decimal, ASCII & a
function
Michael McAlpin
Instructor - COP3502 - CS-1
Fall 2016
EECS-UCF
[email protected]
November 27, 2016
Abstract
The purpose of this lab problem is to print the binary, hex, decimal, and ASCII
values of the upper and lower case alphabet.
This problem will only work with the letters A through Z, upper and lower case.
The UPPER case letters will be converted to lower case by invoking the conversion
function named ToLower. This function will only use bit manipulation to
accomplish the conversion.
1 Objectives
1.1 Inputs
The only input is the name of the program - myHexLetters. No other command line
parameters are required.
1.1.1 Command Line arguments
The program will be invoked as follows:
• myHexLetters
2 Process
The program myHexLetters will generate and display the upper and lower case letters
from A through Z. The conversion will be accomplished on a character basis using bit
manipulations described in more detail below.
1
2.1 char ToLower(char myLetter)
Description: Converts the UPPER case letter to a lower case letter.
Returns: The lower case letter that was passed as input.
Caveat: The conversion must be accomplished using bit manipulation not addition or
subtraction. That is the conversion must be accomplished using an AND, OR,
XOR, or NOT operation - as appropriate.
3 Outputs
The output of the program will be for the upper & lower case letters A through Z.
The outputs are shown below.
UPPER lower
binary Hex Dec - binary Hex Dec -
0100 0001 41 65 A 0110 0001 61 97 a
0100 0010 42 66 B 0110 0010 62 98 b
0100 0011 43 67 C 0110 0011 63 99 c
0100 0100 44 68 D 0110 0100 64 100 d
0100 0101 45 69 E 0110 0101 65 101 e
0100 0110 46 70 F 0110 0110 66 102 f
0100 0111 47 71 G 0110 0111 67 103 g
0100 1000 48 72 H 0110 1000 68 104 h
0100 1001 49 73 I 0110 1001 69 105 i
0100 1010 4a 74 J 0110 1010 6a 106 j
0100 1011 4b 75 K 0110 1011 6b 107 k
0100 1100 4c 76 L 0110 1100 6c 108 l
0100 1101 4d 77 M 0110 1101 6d 109 m
0100 1110 4e 78 N 0110 1110 6e 110 n
0100 1111 4f 79 O 0110 1111 6f 111 o
0101 0000 50 80 P 0111 0000 70 112 p
0101 0001 51 81 Q 0111 0001 71 113 q
0101 0010 52 82 R 0111 0010 72 114 r
0101 0011 53 83 S 0111 0011 73 115 s
0101 0100 54 84 T 0111 0100 74 116 t
0101 0101 55 85 U 0111 0101 75 117 u
0101 0110 56 86 V 0111 0110 76 118 v
0101 0111 57 87 W 0111 0111 77 119 w
0101 1000 58 88 X 0111 1000 78 120 x
0101 1001 59 89 Y 0111 1001 79 121 y
0101 1010 5a 90 Z 0111 1010 7a 122 z
2
Scoring will be based on the following rubric:
Percentage Description
-100 Cannot compile on Eustis
- 30 Does not convert UPPER case to lower
case using bit manipulation
- 20 Cannot output binary value
- 20 Cannot output hex value
- 20 Cannot output decimal value
- 20 Cannot output character value
- 10 Output does not match format shown in the
Output section defined above.
5 Submission Instructions
The assignment shall be submitted via WebCourses.
The source file named myHexLetters.c.
1
1 With comments that confirm - “Your statement that the program is entirely your own work and that
you have neither developed your code together with any another person, nor copied program code from any
other person, nor permitted your code to be copied or otherwise used by any other person, nor have you
copied, modified, or otherwise used program code that you have found in any external source, including but
not limited to, online sources”.
3