Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I am at the intermediate level in computer science. Simple codding with sufficient comments. Thank you in advance. CMPS 2433 Discrete Structures and Analysis Program
I am at the intermediate level in computer science. Simple codding with sufficient comments. Thank you in advance.
CMPS 2433 Discrete Structures and Analysis Program 1 Spring 2020 Due Wednesday, Feb. 19, 2020 As an instructor in the Connect Learning System, I have a multitude of options to select from when making an assignment. A C++ program to manage those options could have a separate flag (bool variable) for each condition that would be turned on or off. If there were 16 options (I only wish ), 16 different variables would be required. Being the efficient programmer that you are, you decide to save memory by using a single variable and using bitwise operators to manage the options. Starting with the rightmost bit, the options are: 1. Time Limit 2. Printing Allowed 3. Scrambled questions 4. Password Protected 5. Point Values Shown 6. Question Titles Shown 7. References Shown 8. Access to external links allowed 9. Formulas shown 10. Only 1 attempt allowed 11. Correct letter case required 12. Late submissions allowed 13. Access to eBook allowed 14. Access to "Check my work" allowed 15. Correct spacing and punctuation required 16. "Ask the instructor" allowed Output will be to a file named lastname_firstname_bits.out. Display your name as the first line of output. Option A (Your last name begins with K - Z) Input will be from the file named "bits.dat". You will read in an integer in decimal form from 0 to 65535. 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, the assignment number along with the options which are turned on will be described in the output file. Read until the end of file. Sample input: 28 Corresponding output: Cerise Wuthrich ASSIGNMENT #1 OPTIONS This assignment has a time limit. The question in this assignment may be printed. The questions in this assignment will be scrambled. ASSIGNMENT #2 OPTIONS The questions in this assignment will be scrambled. This assignment is password protected. Point values for each question will be shown. Option B (Your last name begins with A-J) Input will be from the file named "on_off.dat" There will be exactly ten lines of data. For each assignment, you will read in a series of 16 occurrences of on or off. The first on or off will used to set the leftmost bit (Ask the instructor). The last on or off on the line will used to set the rightmost option (Time limit). Based on those values, you will use bitwise operators to appropriately set the bits of the single variable. The resulting decimal number will be sent to the output file, along with the assignment number. Sample input: off off off off off off off off off off off off off on on on on off off off off off off off off off off off on on on off soes here Corresponding output: Cerise Wuthrich my name ASSIGNMENT #1 FLAG IS 7 ASSIGNMENT #2 FLAG IS 32782 Turn in: Printout of program Printouts of 2 input files, mine and one you make up Printouts of 2 corresponding output filesStep 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