1.1
DESCRIPTION
Files to submit: newAlphabet.cpp
Time it took Matthew to complete: 5 mins
· All programs must compile without warnings when using the -Wall and -We
or options
· Submit only the files requested
· You may either submit the file directly or a zip file that contains the files. Make sure not to submit zipped folders unless the assignment says to do so.
· Your program must match the output exactly to receive credit.
· Make sure that all prompts and output match mine exactly.
· The easiest way to do this is to copy and paste them from here. Be careful about non-ASCII characters though in the HTML as they can cause some weird problems if you put them in your program.
· All input will be valid unless stated otherwise
· Print all real numbers to two decimal places unless otherwise stated
· The examples provided in the prompts do not represent all possible input you can receive.
· All inputs in the examples in the prompt are underlined
· You don't have to make anything underlined it is just there to help you differentiate between what you are supposed to print and what is being given to your program
· If you have questions please post them on CampusWire
You have decided to create an alternative representation for letters of the alphabet. In your scheme the first 26 bits of an unsigned integer representing a character of the alphabet and the 27th bit representing either lowercase or uppercase. The least significant bit (bit 0) is a, the next bit (bit 1) represents b, and so on with the last bit (bit 25) representing z. If the capital bit (bit 26) is 1 it means the letter is uppercase and if it is 0 it means the letter is lowercase. You are to write a program that accepts “letters” in your new representation and then prints out their meaning.
Inputs
· Input will be given on the command line (argc and argv) and not through standard input(scanf)
· Each “letter” will be represented as an unsigned int
· Some examples
Lette
Numerical Representation
Binary Representation
a
1
XXXXXXXXXX XXXXXXXXXX
A
XXXXXXXXXX
XXXXXXXXXX XXXXXXXXXX
2
XXXXXXXXXX XXXXXXXXXX
B
XXXXXXXXXX
XXXXXXXXXX XXXXXXXXXX
c
4
XXXXXXXXXX XXXXXXXXXX
C
XXXXXXXXXX
XXXXXXXXXX XXXXXXXXXX
d
8
XXXXXXXXXX XXXXXXXXXX
D
XXXXXXXXXX
XXXXXXXXXX XXXXXXXXXX
e
16
XXXXXXXXXX XXXXXXXXXX
E
XXXXXXXXXX
XXXXXXXXXX XXXXXXXXXX
Restrictions
1. You must use bitwise operators to solve this problem
2. You can NOT use the bitset class
3. You cannot just have a chain of if statements comparing against the numeric value of each letter. For example, something similar to the below would not be allowed
if(letter == 1)
cout
'a';
else if (letter) == 2
cout
'b'
else if (letter) == 4
cout
'c'
…
4. If you do the above you will receive 0 credit for this problem
Examples
1. ./newAlphabet.out XXXXXXXXXX
You entered the word: cat
2. ./newAlphabet.out XXXXXXXXXX XXXXXXXXXX
You entered the word: ZeBra