Hi Guys, I haven't used C for a while so I am abiot rusty, so I need to revert back to basics.
I want to create a logic gate sim in C and run it throug the CMD prompt.
The user will select the gate that they want, then they will be asked how many inputs for that gate(some gates can have no more than 1 input as some have to have at least 2). how do I get that value get entered from the scanf to create an array of that size, i.e, AND gate selected with 4 inputs, so therefore the array will be 4 large.
Secondly, the user will then be asked to set the values for the input(1's 0r 0's). how do I get these values using the scanf to populate the array? That is what I am having trouble with.
Then gate selected will then run a for loop on the array checking to see what it contains and then output the correct response (0 or 1). The last thing I want to know is how to Get the output value to be put into an array, where the size has been specified by the user.
e.g. User selects AND gate with 4 inputs, an array is created the size of 4. The user is asked to specify the size of the array for the output. One the gate has worked through the array the output value will be duplicated for every element in the output array.
I hope this makes sense, I have never being very good at explaining things, general pointers or code snippet would be great.
Thankyou in advance.