Question: 1. Write a C/C++ code to convert a string (like 100) into a decimal number. int convert(std::string& bstr); // 00100 2. Write a C/C++ program

1. Write a C/C++ code to convert a string (like "100") into a decimal number. int convert(std::string& bstr); // "00100"

2. Write a C/C++ program to take a float number and extract sign/fraction and exponent from IEEE 754 float standard void extract(float n, uint8_t& sign, uint32_t& fraction, uint32_t& exponent);

3. Write a function in C/C++ and set a specific bit to either 1 or 0 uint32_t set_bit(uint32_t n, int p, bool s); //if s == true set the bit to 1, s == false set the bit to 0, p is the position of the bit

4. Write a function to display the bit pattern for a given number (read each bit check if it is zero or one and display) void show_bits(uint32_t n);

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!