C/C++ Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingC/C++ Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old December 11th, 2014, 10:44 AM
iamirish79 iamirish79 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2014
Posts: 2 iamirish79 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 35 m 7 sec
Reputation Power: 0
General - C/C++ code

I have the following code below, i am trying to add xnorr,norr,nandd function to it, how would i do this




char nott(char operand);
char andd(char operand1, char operand2);
char orr(char operand1, char operand2);
char xorr(char operand1,char operand2);

#define PREFERRED 'p'
#define OTHER 'o'
#define INVALID 'x'

char nott( char operand )
{
char result=INVALID;
if (operand == PREFERRED )
result=OTHER;
else
result=PREFERRED;
return (result);
}
char andd(char operand1, char operand2)
{
char result=INVALID;
if (operand1==PREFERRED)
{
if (operand2==PREFERRED)
{
result=PREFERRED;
}
else if (operand2==OTHER)
{
result=OTHER;
}
}
else if(operand1==OTHER)
{

if(operand2==OTHER)

{

result=OTHER;

}

else if (operand2==PREFERRED)

{

result=OTHER;

}

}

return (result);

}

char orr(char operand1, char operand2)

{

char result=0;

result=INVALID;

if (operand1 == PREFERRED)

result = PREFERRED;

else if (operand2==PREFERRED)

result = PREFERRED;

else

result = OTHER;

return (result);

}

char xorr(char operand1,char operand2)

{

char result=orr(andd(nott(operand1),operand2),andd(nott (operand2),operand1));

return(result);

}

char nandd(char operand1,char operand2)

{

char result=INVALID;

result=nott(andd(operand1,operand2));

return(result);

}

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingC/C++ Help > General - C/C++ code


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap