-
December 19th, 2014, 08:09 AM
#1
[RESOLVED] HELP : converting a decimal number given by the user to binary using C++
Write a C++ program that adds three binary numbers of 8-bit
each. Every number is stored into an array of 8 elements.
Example:
Array A
0 1 2 3 4 5 6 7
0 1 1 0 1 1 1 0
+
Array B
0 1 2 3 4 5 6 7
0 1 1 0 1 1 1 0
+
Array C
0 1 2 3 4 5 6 7
0 1 1 0 1 1 1 0
Store the result into an array D of 8 elements. Your program
should show the decimal numbers for every binary number.
Print screen of 6 answers. This means you should try your
program six times with different numbers in every run and show
the printed screen result.
could you guys help me with this exercise
-
December 19th, 2014, 09:09 AM
#2
Re: [RESOLVED] HELP : converting a decimal number given by the user to binary using C
could you guys help me with this exercise
but this thread is now marked as resolved - so I take it you don't now need guidance?
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)
-
December 19th, 2014, 09:24 AM
#3
Re: [RESOLVED] HELP : converting a decimal number given by the user to binary using C
Originally Posted by 2kaud
but this thread is now marked as resolved - so I take it you don't now need guidance?
clicked resolved by mistake and i cant take it down unless i contact the manager. it would be great to guide me
-
December 19th, 2014, 09:41 AM
#4
Re: [RESOLVED] HELP : converting a decimal number given by the user to binary using C
Helping you would be a very bad idea, because it appears you did not try on your own to devise a plan how to tackle the problem.
I can provide some links though:
http://www.cplusplus.com/doc/tutorial/arrays/
http://www.cplusplus.com/forum/beginner/143405/
Nobody cares how it works as long as it works
-
December 19th, 2014, 10:03 AM
#5
Re: [RESOLVED] HELP : converting a decimal number given by the user to binary using C
Originally Posted by boushima
clicked resolved by mistake and i cant take it down unless i contact the manager. it would be great to guide me
First have a look at http://forums.codeguru.com/showthrea...ork-assignment
What guidance are you looking for? How far have you got with this assignment? If you post the code you already have we'll be able to provide further help.
Note when posting code, please use code tags. Go Advanced, select the formatted code and click '#'.
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)
-
December 19th, 2014, 06:33 PM
#6
Re: [RESOLVED] HELP : converting a decimal number given by the user to binary using C
Originally Posted by boushima
could you guys help me with this exercise
Apply the addition algorithm you learned in first grade only now you use binary numbers instead of decimal numbers. These are different number systems but the addition algorithm is general and works the same regardless.
To print the decimal equivalent of a binary number you must understand the properties of a positional number system, that is one where each digit position carries a weight.
Last edited by razzle; December 20th, 2014 at 04:21 AM.
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
|