Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This is C++ assignment. If possible, can you make the program to ask the user again after user inputs garbage value? Design a header file
This is C++ assignment.
If possible, can you make the program to ask the user again after user inputs "garbage" value?
Design a header file named dgates.h that contains a namespace named Gates. The Gates namespace contains definitions of five inline user-defined functions, each of which computes and returns the output (0 or 1) for the AND, OR, NAND, NOR and XOR gate respectively. Design the main program that uses the functions from the Gates namespace. The program will obtain the types of gates (1 to 5) for three gates from the user and four logic inputs (Os and 1s) for gates 1 and 2 respectively for the digital circuit that is shown in figure below. The program will compute and display the output of each gate. The program should also prevent the "garbage input", i.e. incorrect input values. A sample run of the program could be as shown in figure below. Types of gates available: 1. AND 2. OR 3. NAND 4. NOR 5. XOR Select gate #1 (1 to 5) => 1 Enter two inputs for gate #1 (separated by a space) => 0 1 Select gate #2 (1 to 5) => 3 Enter two inputs for gate #2 (separated by a space) => 1 0 Select gate #3 (1 to 5) => 2 Outputs => yl = 0 y2 = 1 y3 = 1Step 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