Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write two C++ functions called reverse(arg). These should be overloaded functions in C++. The first should take an unsigned char as an argument and return

Write two C++ functions called reverse(arg). These should be overloaded functions in C++. The first should take an unsigned char as an argument and return an unsigned char. The second should take an unsigned int as an argument and return an unsigned int. Both functions should reverse the bits in the word sent as an argument and return the result using ONLY the bitwise operators (the use of any builtin C or C++ library functions is not allowed). For example, if the char version of reverse() is called with an argument of 0x5B, it should return a value of 0xDA.

Write a main() program that tests your reverse() functions for proper operation. Turn in the source code for the reverse() functions AND the main() program. These may be included in the same file

Write a function called negate() that takes a float as an argument and returns a float. The return value should be the negation of the argument (i.e., negative if the argument was positive, and positive if the argument was negative). The negate() function may use ONLY the bitwise operators and pointer operations! Note that this will require a bit of research on how floating point numbers are represented in a computer and some fancy pointer manipulation as the bitwise operators will not take a float as an argument.

Write a main() program that tests your negate() function for proper operation. Turn in the source code for the negate() function AND the main() program. These may be included in the same file

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

Step: 3

blur-text-image

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

Probabilistic Databases

Authors: Dan Suciu, Dan Olteanu, Christopher Re, Christoph Koch

1st Edition

3031007514, 978-3031007514

More Books

Students also viewed these Databases questions

Question

What are the four steps involved in choosing a package?

Answered: 1 week ago

Question

What is DDL?

Answered: 1 week ago