Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Coding All programs must compile without warnings when using the -Wall and -Werror options Submit only the files requested ? Do NOT submit folders

C++ Coding

All programs must compile without warnings when using the -Wall and -Werror options

Submit only the files requested

? Do NOT submit folders or compressed files such as .zip, .rar, .tar, .targz, etc If submitting in a group on Grade Scope please make sure to mark your partner.

? Only one of you has to submit there

Your program must match the output exactly to receive credit.

Make sure that all prompts and output match mine exactly.

Easiest way to do this is to copy and paste them

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 Piazza

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

Each letter will be represented as an unsigned int

Some examples

Letter

Numerical Representation

Binary Representation

a

1

000 0000 0000 0000 0000 0000 0001

A

67108865

100 0000 0000 0000 0000 0000 0001

b

2

000 0000 0000 0000 0000 0000 0010

B

67108866

100 0000 0000 0000 0000 0000 0010

c

4

000 0000 0000 0000 0000 0000 0100

C

67108868

100 0000 0000 0000 0000 0000 0100

d

8

000 0000 0000 0000 0000 0000 1000

D 67108872 100 0000 0000 0000 0000 0000 1000

Restrictions

You must use bitwise operators to solve this problem

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' ...

If you do the above you will receive 0 credit for this problem

Examples

1. ./newAlphabet.out 4 1 524288 You entered the word: cat

2. ./newAlphabet.out 100663296 16 67108866 131072 1 You entered the word: ZeBra

e

16

000 0000 0000 0000 0000 0001 0000

E

67108880

100 0000 0000 0000 0000 0001 0000

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

MFDBS 91 3rd Symposium On Mathematical Fundamentals Of Database And Knowledge Base Systems Rostock Germany May 6 9 1991

Authors: Bernhard Thalheim ,Janos Demetrovics ,Hans-Detlef Gerhardt

1991st Edition

3540540091, 978-3540540090

More Books

Students also viewed these Databases questions