Write a program that takes two command line arguments at the time the program is executed....
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a program that takes two command line arguments at the time the program is executed. Both arguments are to be numerical values restricted to 22-bit unsigned integers. The input must be fully qualified, and the user should be notified of any errors with the input provided by the user. The first argument is to be considered a data field. This data field is to be is operated upon by a mask defined by the second argument. The program should display a menu that allows the user to select different bit- wise operations to be performed on the data with the mask. The required operations are: Set, Clear and Toggle. Both data and mask should be displayed in binary format. And they must be displayed such that one is above the other so that they may be visually compared bit by bit. If data and mask are both less than 256, then the binary display should only show 8 bits. If both values are less the 65536, then the binary display should only show 16 bits. The menu must also allow the user to re-enter a value for data and re-enter a value for the mask. Use scanf() to read data from the user at runtime and overwrite the original values provided at execution time. All user input must be completely qualified to meet the requirements above (up to 22-bit unsigned integer values). Printing binary should be done with shifting and bitwise operations. No multiplication or division is needed to produce binary output to the screen. Write a program that takes two command line arguments at the time the program is executed. Both arguments are to be numerical values restricted to 22-bit unsigned integers. The input must be fully qualified, and the user should be notified of any errors with the input provided by the user. The first argument is to be considered a data field. This data field is to be is operated upon by a mask defined by the second argument. The program should display a menu that allows the user to select different bit- wise operations to be performed on the data with the mask. The required operations are: Set, Clear and Toggle. Both data and mask should be displayed in binary format. And they must be displayed such that one is above the other so that they may be visually compared bit by bit. If data and mask are both less than 256, then the binary display should only show 8 bits. If both values are less the 65536, then the binary display should only show 16 bits. The menu must also allow the user to re-enter a value for data and re-enter a value for the mask. Use scanf() to read data from the user at runtime and overwrite the original values provided at execution time. All user input must be completely qualified to meet the requirements above (up to 22-bit unsigned integer values). Printing binary should be done with shifting and bitwise operations. No multiplication or division is needed to produce binary output to the screen.
Expert Answer:
Answer rating: 100% (QA)
Below is a simple C program that fulfills the described requirements It takes two command line argum... View the full answer
Related Book For
Numerical Methods With Chemical Engineering Applications
ISBN: 9781107135116
1st Edition
Authors: Kevin D. Dorfman, Prodromos Daoutidis
Posted Date:
Students also viewed these operating system questions
-
Managing Scope Changes Case Study Scope changes on a project can occur regardless of how well the project is planned or executed. Scope changes can be the result of something that was omitted during...
-
A machine requires three hours to make a unit of Product A and nine hours to make a unit of Product B. Last month the machine operated for 957 hours, producing a total of 145 units. How many units of...
-
Beginning accounts receivable were $43,375. All sales were on account and totaled $187,600. Cash collected from customers totaled $182,450. Required: Calculate the ending accounts receivable balance?
-
A worker views leisure and income as goods and has an opportunity to work at an hourly wage of $ 15 per hour. a. Illustrate the workers opportunity set in a given 24- hour period. b. Suppose the...
-
Confirm that the definition of the streamfunction given in the text satisfies the continuity equation. Use this in the N-S equation and derive the form for the \(E^{4}\) operator in spherical...
-
Fowler Company produces a product that sells for $200 per unit and has a variable cost of $125 per unit. Fowler incurs annual fixed costs of $450,000. Required a. Determine the sales volume in units...
-
The December 31, 2024, unadjusted trial balance for the Wolkstein Drug Company is presented below. December 31 is the company's year-end reporting date. Account Title Cash Accounts receivable Prepaid...
-
1 to 3. First, post the unadjusted balances from the unadjusted trial balance that was given and the adjusting entries that were made in Problem 2-3 into the appropriate T-accounts (on the T-accounts...
-
Which retirement plan is best for a person who is a consultant (self-employed) and makes $150,000? They want to put away about 10% per year. Pension SEP IRA Roth IRA
-
Enumerate, the mandatory and voluntary contents of Clause 49 of the listing agreement regarding corporate governance.
-
Indicate whether the following accounts would normally possess a debit or credit balance: (a) Salaries, (b) Debtors, (c) Creditors, (d) Plant and machinery, (e) General reserve, (f) Patents, (g)...
-
Use the Venn diagram to prove DeMorgans theorem, as given in expression 15b in Section 2.5. Section 2.5 In 1849 George Boole published a scheme for the algebraic description of processes involved in...
-
(a) As at 31 October 2024, a balance of 12,900 on the allowance for doubtful debts account of Daisys business had been brought forward from the previous year end. It was then decided that specific...
-
Explain the importance of strategic alliances.
-
1. a) In a land-mark judgment in the Court of Appeal, in the case of Edwards v. National Coal Board (NCB), Lord Justice Asquith awarded 984 (about 25,000 in today's money) to the widow for the NCB's...
-
Give the structural formulas of the alkenes that, on ozonolysis, give: a. (CH3)2C=O and CH2=O b. Only (CH3CH2)2C=O c. CH3CH=O and CH3CH2CH=O d. O=CHCH2CH2CH2CH=O
-
In this problem, you are going to investigate the work required to solve a matrix system using GaussSeidel. The matrix system is defined by the entries and the forcing vector entries are Your program...
-
Solve the system using Gauss elimination with pivoting. Determine the solution x and the determinant of the original matrix, A. 3 3 - 1 -1 -2 4 2 4 5 4 1 2 0 3-2 3 1 X1 0 X2 8 ][-] X3 2 X4 14
-
What ODE is solved by the following MATLAB code and what method is used? Include the initial condition in your answer. 1 function problem4_23 2 3 4 nsteps = 100; y = 1; t = 0; h = 0.01; 5 6 g=figure;...
-
Obtain the time variation of the lift and propulsive force coefficients and their plots for the airfoil given by Example 8.5. Assume that the profile pitches about quarter chord point. Example 8.5...
-
Write down a numerical solution algorithm for the LU decomposition solution of the pseudo penta diagonal matrix equation given by (A11.4). A11.4 || B C 2 A2 B2 C2 922 An-1 Bn-1 Cn-1 -1 An Bn R R Rn-1...
-
Obtain Eq. 8.66 as a relation between the wake vorticity and the reduced circulation. Eq. 8.66 w(x) = k(Q; cosx-22, sin x) cos ks +k(Q; sin x+Q, cos x) sinks, Q = Q, +Q;i
Study smarter with the SolutionInn App