Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 How to make a Gate code in turing..here I used XOR....
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
GB




PostPosted: Mon Dec 13, 2004 2:40 pm   Post subject: How to make a Gate code in turing..here I used XOR....

code:

%XOR GATE
var a, b : int
loop
    put "What is the input for A?"
    get a
    if a > 1 or a < 0 then
        put "Error"
    else
        exit
    end if
end loop
loop
    put "What is the input for B?"
    get b
    if b > 1 or b < 0 then
        put "Error"
    else
        exit
    end if
end loop
if a = 0 and b = 0 then
    put "Y = 0"
elsif a = 0 and b = 1 then
    put "Y = 1"
elsif a = 1 and b = 0 then
    put "Y = 1"
else
    put "Y = 0"
end if
Sponsor
Sponsor
Sponsor
sponsor
cool dude




PostPosted: Mon Dec 13, 2004 5:54 pm   Post subject: (No subject)

it would be better if u made it for all the gates but it's still good for people that can't remember a little truth table.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: