Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write functions with C++ programming : print_bits8(unsigned char b) print_bits16(unsigned short int b) print_bits32(unsigned int b) print_bits64(unsigned __int64 b) that print out unsigned integers b

  1. Write functions with C++ programming :

print_bits8(unsigned char b)

print_bits16(unsigned short int b)

print_bits32(unsigned int b)

print_bits64(unsigned __int64 b)

that print out unsigned integers b in binary notation. The bit number should also be printed above the binary number to make it easier to read a particular bit. For example,

unsigned short int b = 65000;

print_bits16(b);

prints out:

5432109876543210

1111110111101000

Use bit-wise operators to solve this problem. Furthermore, dont use an array such as bit[i] . Start by finding bit-0, then bit-1 and so on. The bits, however, should be printed out in the normal order -- ie the higher bits before the lower bits as indicated in the example above. Write a main function that illustrates the functions using the example above.

  1. Modify the functions in part a) to work on the Arduino and test them with a setup function with the example from part a). Hint: use sizeof() to help identify which variable types are required to represent unsigned 8, 16, 32 and 64 (if possible) bit integers.

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_2

Step: 3

blur-text-image_3

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

Database 101

Authors: Guy Kawasaki

1st Edition

0938151525, 978-0938151524

More Books

Students also viewed these Databases questions

Question

What is Change Control and how does it operate?

Answered: 1 week ago

Question

How do Data Requirements relate to Functional Requirements?

Answered: 1 week ago