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
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