Question: #include #include // Convert 0xF9B7A5EC from hex to binary: // Convert 10110011 01011101 11010100 00101100 from binary to hex: // Convert 0x0000DA from hex to

#include #include

// Convert 0xF9B7A5EC from hex to binary: // Convert 10110011 01011101 11010100 00101100 from binary to hex: // Convert 0x0000DA from hex to decimal notation: // Convert 11000101 from binary to decimal notation:

// Problem 2.60 in BO unsigned replace_byte (unsigned x, int i, unsigned char b) { // implement this return 2; }

// Problem 2.68 in BO int lower_one_mask (int n) { // implement this return 2; }

void bin2dec(const char *bin_num) { // implement this }

void dec2bin(int num) { // implement this }

// test code; do not modify int main() { char *bin_nums[] = {"0", "10010110", "10111011001001"}; int dec_nums[] = {0, 1, 77, 159, 65530, 987654321}; int i; int x = 0x12345678, b = 0xAB;

printf("=== replace_byte === "); for (i =0; i < 2; i++) printf("replace_byte(%x, %d, %x) --> %x ", x, i, b, replace_byte(x, i, b)); for (i = 0; i < sizeof(dec_nums)/sizeof(int); i++) printf("lower_one_mask(%d) --> %d ", dec_nums[i], lower_one_mask(dec_nums[i]));

printf("=== bin2dec === "); for (i = 0; i < sizeof(bin_nums)/sizeof(char *); i++) bin2dec(bin_nums[i]);

printf("=== dec2bin === "); -UUU:----F1 hw2.c Top L1 (C/l Abbrev) ----------------------------------------------------------------------------------------------------------------------------------------- Loading cc-langs...done

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!