Patriot is a company that manufactures gate operators. There is a circuit board in the housing which contains a set of programming dipswitches that are manually set by the owner. These dipswitches are used to customize the operation of the gate. Each switch corresponds to a setting that is either on or off. Within a C++ program, a separate flag (bool variable) could be used to represent each condition. If there were 10 conditions (or states), 10 different variables would be required. Being the efficient programmer that you are, you decide to save memory space by using a single variable and using bitwise operators to manage the options. Starting with the rightmost bit, suppose there are 8 dipswitches representing these options: 0. Sensor Enter (There is a sensor that will automatically open the gate and allow visitors onto the property.) 

1. Soft Open (The gate opening speed will gradually diminish as it opens.) 2. Soft Close (The gate opening speed will gradually diminish as it closes.) 3. Automatic Close (The gate will close automatically after a visitor enters/exits.) 4. Sensor Exit (There is a sensor that will automatically open the gate and allow visitors to exit the property.) 5. Intercom keypad (The intercom is enabled allowing visitors to signal the base station in the house.) 6. Pin Lock (When on, disables the ability to manually operate the gate.) 7. Photo Beam (When on, senses objects in the way of gate open/close and automatically reverses.) 

Name your source code: lastname_firstname_1*.cpp (where * is replaced by A or B) Name your output file: lastname_firstname_gate*.out (where * will be replaced by A or B) Display your name as the first line of output. Option A (Last name begins with A – M) Input will be from the file named “gateoptions.dat” The file will consist of an unknown number of integers ranging from 0 to 255. You will examine the bits in the binary format of this number. You will use bitwise operators to determine which options are on and which are off. For each number read in, describe each option as on/off. Also, for the first integer read in, you will toggle all 8 bits using a bitwise operator and output the base ten value for that result. 

Read until the end of file. Sample input: 6 64 Corresponding output: Catherine Stringfellow Gate #1 Sensor Enter: OFF Soft Open: ON Soft Close: ON Automatic Close: OFF Sensor Exit: OFF Intercom Keypad: OFF Pin Lock: OFF Photo Beam: OFF If options on the first gate are toggled, value of flag would be 249. Gate #2 Sensor Enter: OFF Soft Open: OFF Soft Close: OFF Automatic Close: OFF Sensor Exit: OFF Intercom Keypad: OFF Pin Lock: ON Photo Beam: OFF Option B (Last name begins with N-Z) Input will be from the file named “on_off.dat” There will be exactly ten lines of data. For each gate, you will read in a series of 8 occurrences of on or off. The first on or off will used to set the leftmost bit (Photo Beam). The last on or off on the line will be used to set the rightmost option (Sensor Enter). Based on those values, you will use bitwise operators to appropriately set the bits of the single variable. The resulting base ten number will be sent to the output file, along with the gate number. For the first line of data ONLY, after determining the flag, toggle the PHOTO BEAM bit only and output the resulting value of the flag. Sample input: off off off off off off off off on off off on off off on on Corresponding output: Catherine Stringfellow Gate #1 FLAG is 0 If the PHOTO BEAM bit is toggled, the flag would be 128. Gate #2 FLAG is 14