Hi, Thanks everyone for the help so far and my apologies for the numerous post. This should be my last post if I'm able to get this problem resolved. I have implemented a function named to_string for the bitsetts class, but why does the program throw a "Run-Time Check Failure #2 - Stack around the variable 'result' was corrupted"? after it has run the function? I am puzzled. Is it due to the size of the variable of bitsetts? But I am not allowed to change the size as I can't modify the main(). I don't quite understand what I need to do from here. Hope you are able to help. Thank you. Note: int main() cannot be modified since it is a school assignment.
Is bitsetts::array supposed to be bit-packed or not? Because you're creating an array of bits/CHAR_BIT bytes, but you're accessing it as if each byte was representing an entire boolea value, without bit-packing.
You are not implementing it properly at all.
You've calculated how many bytes you need to store a given number of bits.
But then you only set/test entire bytes.
You need to use some bitwise operators to set/test the bits in the bytes.