Question: 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

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 = 1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!