Question
here is the text file: P01: 10100001001010111000001111000000 P02: 11110011101010010110110010111011 P03: 10000101101010111101011101110111 P04: 10110011111111000111110110001111 P05: 10011011000101100001011100010100 P06: 00110010001100000101111111000010 P07: 10111110100111111000001000101000 P08: 00100101101000011001001100001000 P09: 11101000110000101110000111000001 P10: 00010101001101000001101000100000
here is the text file:
P01: 10100001001010111000001111000000 P02: 11110011101010010110110010111011 P03: 10000101101010111101011101110111 P04: 10110011111111000111110110001111 P05: 10011011000101100001011100010100 P06: 00110010001100000101111111000010 P07: 10111110100111111000001000101000 P08: 00100101101000011001001100001000 P09: 11101000110000101110000111000001 P10: 00010101001101000001101000100000 P11: 10000001000111000111100100010101 P12: 00010011011110000011111011011100 P13: 01000000011111001110011100010001 P14: 11101110110111110111101101011111 P15: 00101100011111001000100010101110 P16: 11010110011001000111111011111011 P17: 00001100101001000110111010100010 P18: 01010000010111101000000011010000 P19: 00101010110011011111111110111101 P20: 00100010011000000110011101101001
You are required to write a C++ program that would serve as a Bit Stuffing which is a mechanism of inserting one or more non-information bits into a message to be transmitted, to break up the message sequence, for synchronization purposes in computer networking. You are provided a text file (bits.txt) with this lab which contains the Packet number and sequence of bits for each packet. Ask the User to provide a sequence of 0's and 1's, e.g., 1100 and search for it in the file. You are required to perform the following tasks: - Read the text file line by line - Create a Bits class with at least the following: - Private data members - string sequence - string packet - Corresponding Getters and Setters along with a Default Constructor - A method that would simply cout packet: sequence - A method that checks to see if any value of sequence or packet is empty and returns true if any of them is empty else returns false. This is an optional method and you are free to ignore it but can be helpful in not displaying the null values. - Create a ( method that creates a Bits object for the above class by searching whether a word read from a file contains the user entered bit sequence or not. If it does, it should set the sequence and packet for that particular object using setter methods and returns the object. - Every time a sequence entered by the user is found in the read file, you are required to create an array of Bits objects in the heap. It means that you are constantly increasing the size of the array in the heap on each search of the sequence. For this purpose, use a method that can resize the array in the heap that would return a Bits object pointer by taking in as a parameter, a Bits object pointer and address of size variable from the main method. The definition of this function should be Make sure to delete any space occupied programmatically when it's not required. - Create a function to display the report shown below in the expected output. - Finally, prompt to see if the user wants to start from the beginning and enter another sequence, expanding the array. - You can only use \#inc1udeStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started