1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Amiraneli [1.4K]
3 years ago
14

Write a program binary.cpp that reads a positive integer and prints all of its binary digits.

Computers and Technology
1 answer:
earnstyle [38]3 years ago
5 0

Answer:

View image below.

Explanation:

They're just asking you to create a num2bin function on Cpp.

If you search for "num2bin in C", you can find a bunch of answers for this if you think my solution is too confusing.

One way to do it is the way I did it in the picture.

Just copy that function and use it in your program. The rest you can do yourself.

You might be interested in
An alternative to hexadecimal notation for representing bit patterns is dotted decimal notation in which each byte
zysi [14]

An alternative to hexadecimal notation for representing bit patterns is dotted decimal notation in which each byte in the pattern is represented by its base ten equivalent. In turn, these byte representations are separated by periods. For example, 12.5 represents the pattern 0000110000000101 (the byte00001100 is represented by 12, and 00000101 is represented by 5), and the pattern 100010000001000000000111 is represented by 136.16.7. Represent each of the following bit patterns in dotted decimal notation,

a. 0000111100001111 b. 001100110000000010000000c. 0000101010100000

4 0
3 years ago
Suppose we can buy a chocolate bar from the vending machine for $1 each. Inside every chocolate bar is a coupon. We can redeem s
Tanya [424]

Answer and Explanation:

Using JavaScript:

/* program should take N input which represents the dollar amount and output how many chocolate bars and how many coupons we have*/

function chocolatebar(dollars){

var dollaramt= dollars;

var i;

for(i=0; i <= dollaramt; i++){

i=i+6

?

Alert ("you have 1 extra chocolate bar");

:

Alert ("keep buying chocolate bars to get more coupons for a bonus chocolate bar")

}

}

*

7 0
3 years ago
The timer is running in the up mode with a period of 800 cycles. Channel 1 engages the output mode (Set/Reset) and sets its regi
Soloha48 [4]

Answer:

Explanation:

Part a)

_______________ ____________ _____________ ___

TAR | /\ \/ /\ \/ /\

|//////////|____________|____________|_____________|__________|

0 600 800 600 800 600

PWM Duty Cycle = 200/800 = 25%

Part b)  

______________ _________________ _________ _________________

TAR | \/ /\ \/ /\ \/

|//////////|_________|_________________|__________| _______________|

0 600 800 600 800 600

PWM Duty Cycle = 600/800 = 75%

7 0
3 years ago
A type of sensor used to detect which way around a device is being held. ​
Marta_Voda [28]
There’s 3 main ones accelerometer, gyroscope, and magnetometer.
8 0
2 years ago
What is the minimum number of bits required to store 11 different values?
yawa3891 [41]

Answer:

4 bits are required. 4 bits can represent 16 different values (2*2*2*2 or ). 3 bits can only represent 8 different values. In the general case n bits can represent values, or correspondingly m values can be represented by bits.

5 0
3 years ago
Other questions:
  • Write the definition of a method named printPowerOfTwoStars that receives a non-negative integer n and prints a string consistin
    10·1 answer
  • Your uncle spent most of his teen years in a hospital undergoing treatment for a severe physical illness. As an adult, he is rat
    10·1 answer
  • A user can easily moved to the end of document by pressing what key combination?
    8·2 answers
  • Victoria is creating a brochure for her photography studio. She designed the layout and placed a photo in the center of the page
    13·1 answer
  • Explain with the help of an example that family background affects the entrepreneurial behaviour of people
    12·1 answer
  • Violations of security policies are considered to be a(n) __________ issue upon which proper disciplinary actions must be taken.
    7·1 answer
  • Which best describes obliteration in a forged document?
    11·1 answer
  • NEED BY 15 MINUTES PLEASE! WILL MARK BRAINLIEST!You can create special effects in an image using a camera or a photo-editing too
    5·1 answer
  • What necessarily happens when a photographer chooses to give either the aperture or the shutter speed priority?
    10·1 answer
  • Write a set of nested loops that display 10 rows of # characters. There should be 15 # characters in each row.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!