Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

8.32 Project 3: Bits Dene a class named Bits that holds a single integer variable. You will use this integer simply as a container of

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed
8.32 Project 3: Bits Dene a class named Bits that holds a single integer variable. You will use this integer simply as a container of bits. The number of bits you can support depends on the type of integer you use. We will use an unsigned long long, which on most platforms occupies 64 bits. However. DO NOT HARD-CODE the type of integer you use throughout your code. You should be able to change only one line of code for your class to work with a different size integer (see the using statement on the second code line below). The code skeleton below gets you started, and also shows you the interface your class needs to implement. I gave you the code for some of the functions. The body of at should help you with many other functions. Class Bits { using IType = unsigned long long; // We only have to change the integer type here, if desired enum {NBITS = sizeof(ITypel*8}; IType bits = 0; public: Bitsi} = default; BitsiIType n) { bits = n; } static int size(} { return NEITS; } bool atlint p03} const { // Returns {tests} the bit at bitposition p05 assert(0 0, shifts bits right n places; if n 0, rotates right n places; if n (b.bits) ; // Be sure to #include I have also defined for you the following non-member, friend functions: . an output stream operator (

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

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions