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

Question #19304

mplement 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 should return the total number of bits in the allocated array.

4.

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 should return the total number of bits in the allocated array.

4.

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.

## Comments

## Leave a comment