PDA

View Full Version : تبدیل کد زیر به #C .ضروری



uthman
سه شنبه 19 آذر 1392, 18:23 عصر
سلام .کسی می تونه کد زیر رو به c# تبدیل کنه ؟خیلی لازمش دارم.


BooleanExp ::= VariableExp | AndExp| ‘(‘ BooleanExp ‘)’
VariableExp ::= ‘A’|’B’| ….|’X’|’Y’|’Z’
AndExp ::= BooleanExp ‘And’ BooleanExp
// defines an interface for all classes that define a
boolean expression.
class BooleanExp {
public:
BooleanExp();
Virtual bool Evaluate(Context&) = 0;
}
// defines a mapping from variables to boolean values.
class context {
public: void Assign(VariableExp*, bool); }
// represents a named variable
class VariableExp : public BooleanExp {
public:
VariableExp(const char*); }
// The constructor takes the variable name as an argument.
VariableExp:VariableExp (const char * name) {
_name = strdup(name); }
// Evaluating a variable returns its value in the current context
bool VariableExp:Evaluate (Context& aContext) {
Return aContext.Lookup(_name);
}

morycom
پنج شنبه 28 آذر 1392, 07:17 صبح
سلام .کسی می تونه کد زیر رو به C#‎‎ تبدیل کنه ؟خیلی لازمش دارم.


BooleanExp ::= VariableExp | AndExp| ‘(‘ BooleanExp ‘)’
VariableExp ::= ‘A’|’B’| ….|’X’|’Y’|’Z’
AndExp ::= BooleanExp ‘And’ BooleanExp
// defines an interface for all classes that define a
boolean expression.
class BooleanExp {
public:
BooleanExp();
Virtual bool Evaluate(Context&) = 0;
}
// defines a mapping from variables to boolean values.
class context {
public: void Assign(VariableExp*, bool); }
// represents a named variable
class VariableExp : public BooleanExp {
public:
VariableExp(const char*); }
// The constructor takes the variable name as an argument.
VariableExp:VariableExp (const char * name) {
_name = strdup(name); }
// Evaluating a variable returns its value in the current context
bool VariableExp:Evaluate (Context& aContext) {
Return aContext.Lookup(_name);
}



********************
ميتوني از سايتهاي تبديل انلاين استفاده كني مثل
http://www.developerfusion.com/tools/convert/vb-to-csharp/