Translating code into C/C++
Dec 8, 2014 at 2:25pm UTC
I am new to C/C++, I have played around with VBscript codes, but no C/C++. Heres what im playing around with for fun so i can start writing code in C/C++. Below are four codes, i wanna take them and rewrite them into a C/C ++ code. Someone please show me how to write these in C/C++.
First Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
public dynamic orr(object operand1, object operand2)
{
dynamic returnValue = default (dynamic);
object result = null;
result = invalid;
if (operand1 == preferred)
{
if (operand2 == preferred)
{
result = preferred;
}
}
if (operand1 == preferred)
{
if (operand2 == other)
{
result = preferred;
}
}
if (operand1 == other)
{
if (operand2 == preferred)
{
result = preferred;
}
}
if (operand1 == other)
{
if (operand2 == other)
{
result = other;
}
}
returnValue = result;
if (trace)
{
traceAdd("orr" );
}
return returnValue;
}
Second Code
1 2 3 4 5 6
public dynamic xnorr(object operand1, object operand2)
{
dynamic returnValue = default (dynamic);
returnValue = nott(xorr(operand1, operand2));
return returnValue;
}
Third Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14
public dynamic xorr(object operand1, object operand2)
{
dynamic returnValue = default (dynamic);
object A = null;
object B = null;
object C = null;
object D = null;
A = nott(operand1);
B = nott(operand2);
C = andd(operand1, B);
D = andd(A, operand2));
returnValue = orr(C, D);
return returnValue;
}
Topic archived. No new replies allowed.