Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8876407
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T19:12:25+00:00 2026-06-14T19:12:25+00:00

I am working on a program that would allow the user to build digital

  • 0

I am working on a program that would allow the user to build digital circuits from virtual logic gates. Every gate would be an instance of a class that represents particular gate type, for example here’s how AND class looks:

public class andgate
{
    public andgate()
    {
        inputs = new bool[7];
        for (int i = 0; i < 7; i++) inputs[i] = true;
        output = (inputs[0] && inputs[1] && inputs[2] && inputs[3] && inputs[4] && inputs[5] && inputs[6]);
    }
    public bool[] inputs;
    public bool output;
}

Every gate has seven inputs but not all of them have to be used (i.e. for a gate with three imputs the remaining four will just be “1” which is AND’s neutral element anyway). Each input is a reference to an output of another gate or to an element of bool array (which stores the input vector) so that signal generated by one gate automatically is sent to the following gate. The problem is I also need the signal to be transmitted dynamically within the gate, i.e. if one of the input signals in AND gate is set to 0 then the output automatically has a 0 value. Therefore when you feed a binary vector to the inputs of the cirtuit, it changes the values of the circuit’s outputs. Or maybe there’s an easier way to simulate a circuit than building it from individual gates? I need it for test pattern generating.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T19:12:26+00:00Added an answer on June 14, 2026 at 7:12 pm

    Make the output property read-only:

    public bool output
    {
        get
        {
            return inputs.All(i => i);
        }
    }
    

    Instead of ANDing all the inputs, just check if there is any input that is false.

    Of course you have to remove the assignment to output in the constructor. This should make your output property “dynamic”.

    You may also want to change the inputs to bool?[] instead, so that a null value would signify that there is no signal. You will then have to remove the initialization of the input array to all true and change the output return to:

    return inputs.All(i => i.GetValueOrDefault(true));
    

    Edited with Tim S’s suggestions in the comments

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a program that I'm working on that register global hotkeys I would
I'm working on a program that uses HTML/CSS/Javascript/JQuery for its user interface. One of
I am working on a project of mine that will allow the user to
im working on a .NET application that would allow me (and subsequent users) to
I'm working on a program that will allow me to multiply/divide/add/subtract binary numbers together.
I'm working to build a .NET program with WPF that will need to be
Ive been working on a program that allows me to updload data from my
I'm working on a program that will sort files based on extension I currently
I'm working on a program that reads in users input as a string, which
I'm working on a program that asks for input, then calculates and posts the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.