-
January 28th, 2016, 12:19 AM
#1
Binary representation of the character value
We want to create a table in such a way that each character value is represented by a 6 bit binary value if i enter a character it should represent in binary.Can any one help me out in finding logic in c program.
000001 A
000010 B
000100 C
if i enter CA the binary digit as to be stored in format 000100000001
-
January 28th, 2016, 03:46 AM
#2
Re: Binary representation of the character value
So the first step is to devise an algorithm on paper that given a character will produce the required binary representation. Once you have this working on paper then the next step is to translate this algorithm into the program. So you need to determine on paper how to convert 'C' into 000100. What does D, E etc convert into? What is the pattern. Given pen and paper, how would you convert F into the required binary etc.
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.5)
-
January 28th, 2016, 05:46 AM
#3
Re: Binary representation of the character value
-
January 29th, 2016, 04:46 AM
#4
Re: Binary representation of the character value
Originally Posted by Jeevan Rudramurthy
We want to create a table
The very first step, always and unconditionally, is clear and consistent explanation of the requirements.
The very first step to clear and consistent explanation is identifying points that may sound ambiguous.
The very second step is resolving the ambiguities into something straight and solid and specific. Only then you can design the feature properly.
What does those "create a table" and "to be stored" really mean? Table on paper? Table in text file? Table in database? Table in memory? You see what I mean? There's nothing to start with until you explain yourself clear.
Best regards,
Igor
-
February 1st, 2016, 08:28 AM
#5
Re: Binary representation of the character value
Does it have to follow that particular pattern? It would be relatively easy to offset and reduce ASCII a little and make that fit your scheme.
ahoodin
To keep the plot moving, that's why.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|