Question
C++ Question! You are very much used to expressing numbers in the decimal system. What do the digits of a number mean? 83526 literally means
C++ Question!
You are very much used to expressing numbers in the decimal system. What do the digits of a number mean? 83526 literally means 6 100 + 2 101 + 5 102 + 3 103 + 8 104 . There is nothing special about the number 10; we can use the number 2 instead. This is what computers do, and this is called the binary system. To express 88 in binary, we note that 88 = 0 2 0 + 0 2 1 + 0 2 2 + 1 2 3 + 1 2 4 + 0 2 5 + 1 2 6 . To distinguish between binary and decimal, we often use the subscripts 2 and 10, so we would write 8810 = 10110002. Similarly, 810 = 10002 and 88810 = 11011110002. Have the first substantial lines of code you write be
cout > x;
if (x == 0) {
cout
return 0;
}
cout
Then write more code so that your program can perform as in the example below:
Enter a strictly positive integer: The binary representation of 888 is given by 1101111000 Program ended with exit codeStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started