# Answer to Question #19299 in C++ for ayesha

Question #19299

CS-355 Assignment 2

Submission Date: 24th November 2012 @ 9:00am

Implement a class called BitArray, which will simulate a list of bits of any size, which can be individually set, cleared, flipped, and queried. You will also implement a function that is to be used by a sample test program, which uses the Sieve of Eratosthenes technique (with the bit array) to find prime numbers.

The BitArray class

Here are some details about the BitArray class:

1. A bit array or binary number is to be implemented with an underlying array of type unsigned char. 'Unsigned' because we are only interested in bits, not in negatives, and type char because it is the smallest integer type. The concept of a BitArray object is that it will store an array of bits indexed at 0, just like normal arrays. The most significant bit represents the sign of the binary number.

2. The array of characters should be created dynamically. The primary constructor has one parameter, which indicates how many bits are needed.

3. The Length() function

Submission Date: 24th November 2012 @ 9:00am

Implement a class called BitArray, which will simulate a list of bits of any size, which can be individually set, cleared, flipped, and queried. You will also implement a function that is to be used by a sample test program, which uses the Sieve of Eratosthenes technique (with the bit array) to find prime numbers.

The BitArray class

Here are some details about the BitArray class:

1. A bit array or binary number is to be implemented with an underlying array of type unsigned char. 'Unsigned' because we are only interested in bits, not in negatives, and type char because it is the smallest integer type. The concept of a BitArray object is that it will store an array of bits indexed at 0, just like normal arrays. The most significant bit represents the sign of the binary number.

2. The array of characters should be created dynamically. The primary constructor has one parameter, which indicates how many bits are needed.

3. The Length() function

Expert's answer

Unfortunately, your question requires a lot of work and cannot be done for free.

Submit it with all requirements as an assignment to our control panel and we'll assist you.

Submit it with all requirements as an assignment to our control panel and we'll assist you.

Need a fast expert's response?

Submit orderand get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

## Comments

## Leave a comment