private Program(string[] args) { op OP = op.list; if (args.Length == 0 || !Enum.TryParse <op>(args[0], true, out OP)) { ShowUsage(0); return; } if (args.Length == 1 && OP != op.list) { ShowUsage(1); return; } switch (OP) { case op.del: if (!Param.del(names.resolve(args[1]))) { Console.WriteLine("Failed to delete " + args[1]); } break; case op.get: { string s = null; Param.get(args[1], ref s); if (s != null) { Console.WriteLine(s); } } break; case op.list: { foreach (string s in Param.list()) { Console.WriteLine(s); } } break; case op.set: Param.set(args[1], args[2]); break; } }
private void numPlus_Click(object sender, EventArgs e) { if (newNum == false) { int num = Convert.ToInt32(label1.Text); if (operate == op.Add) { val = val + num; } else if (operate == op.Sub) { val = val - num; } else if (operate == op.Mul) { val = val * num; } else if (operate == op.Div) { val = val / num; } label1.Text = val.ToString(); newNum = true; //이전에 가지고 있던 연산자를 가지고 연산하는 작업 }// 예외처리 - 연산자를 계속 누르고 숫자를 안눌렀을 경우 //이후엔 마지막에 누른 연산자를 저장 Button bu = (Button)sender; // 여기서 다음 연산해야할 연산자를 저장 if (bu.Text == "+") { operate = op.Add; } else if (bu.Text == "-") { operate = op.Sub; } else if (bu.Text == "*") { operate = op.Mul; } else if (bu.Text == "/") { operate = op.Div; } }
static void Main(string[] args) { //variavel result recebe o retorno do delgate>>d1 var result = 0; // cria-se objeto calculos para acesso dos metodos var a = new Calculos(); // cria-se objeto do tipo op para acesso do delegate op d1 = new op(a.Soma); op d2 = new op(a.Sub); result = d1(5, 3); result = d2(7, 3); //result deve retornar dois valores diferentes // valor 8 //valor 4 }
public dynamic graph1() { if (Session["UserName"] != null) { using (AdityamineralsEntities objDB = new AdityamineralsEntities()) { var output = objDB.Database.SqlQuery <graph1>("[dbo].[ADM_CHART1]").ToList(); var output1 = objDB.Database.SqlQuery <graph1>("[dbo].[ADM_CHART1]").Count(); op ob = new op(); ob.output = output; ob.output1 = Convert.ToString(output1); return(Json(ob, JsonRequestBehavior.AllowGet)); } } else { return(RedirectToAction("Login", "Login")); } }
private static Set <T> binaryOperation(Set <T> leftOperand, Set <T> rightOperand, op Operation = null) { if (!leftOperand.universalSetMembers.Equals(rightOperand.universalSetMembers)) { throw new ArgumentException("Множества принадлежат разным универсальным множествам"); } List <bool> resultDescribeVector = new List <bool>(); for (int i = 0; i < leftOperand.describeVector.Count; ++i) { resultDescribeVector.Add((bool)Operation?.Invoke(leftOperand.describeVector[i], rightOperand.describeVector[i])); } return(Set <T> .FromDescribeVector(resultDescribeVector, leftOperand.universalSetMembers)); }
public block(op op = default, slice <@string> lines = default) { this.op = op; this.lines = lines; }
6 => op => DoConditionalJump(op, x => x == 0), 7 => op => DoBinaryOperation(op, (a, b) => a < b ? 1 : 0),
5 => op => DoConditionalJump(op, x => x != 0), 6 => op => DoConditionalJump(op, x => x == 0),
public FaceSettling() { opening = new op(ope); InitializeComponent(); }
private string GetOpName(op op) { return(op.Method.Name); }
public int Helper(op op) { return(op == op.add ? Int32.Parse(head) + Convert.ToInt32(tail) : Int32.Parse(head) - Convert.ToInt32(tail)); }
public ChannelNick(string n) { switch (n[0]) { case '+': this.opMode = op.VOP; break; case '%': this.opMode = op.HOP; break; case '@': this.opMode = op.CHOP; break; case '&': this.opMode = op.SOP; break; default: this.opMode = op.NOOP; break; } this.nick = n; }
public frm_SiparisAra(op operation) { InitializeComponent(); _operation = operation; }
Assert.AreEqual(t.isOK, attr.DoMatch(op, t.labels), $"labels => {attr.Labels.Aggregate((_s, _c) => _s + ", " + _c)}, got => {t.labels.Aggregate((_s, _c) => _s + ", " + _c)}");
private static Value Op(Value A, Value B, op OP) { switch (A.ValueType) { case ValueType.INT: switch (B.ValueType) { case ValueType.INT: switch (OP) { case op.ADD: return(A.Int + B.Int); case op.SUB: return(A.Int - B.Int); case op.MUL: return(A.Int * B.Int); case op.DIV: return(A.Int / B.Int); case op.MOD: return(A.Int % B.Int); default: throw new InvalidOperationException(); } case ValueType.DOUBLE: switch (OP) { case op.ADD: return(A.Int + B.Double); case op.SUB: return(A.Int - B.Double); case op.MUL: return(A.Int * B.Double); case op.DIV: return(A.Int / B.Double); case op.MOD: return(A.Int % B.Double); default: throw new InvalidOperationException(); } default: throw new InvalidOperationException(); } case ValueType.DOUBLE: switch (B.ValueType) { case ValueType.INT: switch (OP) { case op.ADD: return(A.Double + B.Int); case op.SUB: return(A.Double - B.Int); case op.MUL: return(A.Double * B.Int); case op.DIV: return(A.Double / B.Int); case op.MOD: return(A.Double % B.Int); default: throw new InvalidOperationException(); } case ValueType.DOUBLE: switch (OP) { case op.ADD: return(A.Double + B.Double); case op.SUB: return(A.Double - B.Double); case op.MUL: return(A.Double * B.Double); case op.DIV: return(A.Double / B.Double); case op.MOD: return(A.Double % B.Double); default: throw new InvalidOperationException(); } default: throw new InvalidOperationException(); } default: throw new InvalidOperationException(); } }
_ => base.InterpretUnaryOperator(op, operand)
var(op, value) = instruction;
static void Main(string[] args) { int switch_on = 0; IDictionary Test = null; string interfaceTyp = ""; void askMultiSetSorted() { interfaceTyp = "MultiSetSorted"; Console.WriteLine($"Welche Art von {interfaceTyp} möchten sie testen?"); Console.WriteLine("MultiSetSortedLinkedList --> 1"); Console.WriteLine("MultiSetSortedArray --> 2"); try { switch_on = Convert.ToInt32(ReadLine()); } catch (System.FormatException) { switch_on = 0; } switch (switch_on) { case 1: Test = new MultiSetSortedLinkedList(); break; case 2: Test = new MultiSetSortedArray(); break; default: switch_on = 0; Console.WriteLine("Nö\n"); break; } } void askMultiSetUnsorted() { interfaceTyp = "MultiSetUnsorted"; Console.WriteLine($"Welche Art von {interfaceTyp} möchten sie testen?"); Console.WriteLine("MultiSetUnsortedLinkedList --> 1"); Console.WriteLine("MultiSetUnSortedArray --> 2"); try { switch_on = Convert.ToInt32(ReadLine()); } catch (System.FormatException) { switch_on = 0; } switch (switch_on) { case 1: Test = new MultiSetUnsortedLinkedList(); break; case 2: Test = new MultiSetUnsortedArray(); break; default: switch_on = 0; Console.WriteLine("Nö\n"); break; } } void askSetSorted() { interfaceTyp = "SetSorted"; Console.WriteLine($"Welche Art von {interfaceTyp} möchten sie testen?"); Console.WriteLine("SetSortedLinkedList --> 1"); Console.WriteLine("SetSortedArray --> 2"); Console.WriteLine("BinSearchTree --> 3"); Console.WriteLine("Treap --> 4"); Console.WriteLine("AVL-Tree --> 5"); try { switch_on = Convert.ToInt32(ReadLine()); } catch (System.FormatException) { switch_on = 0; } switch (switch_on) { case 1: Test = new SetSortedLinkedList(); break; case 2: Test = new SetSortedArray(); break; case 3: Test = new BinSearchTree(); break; case 4: Test = new Treap(); break; case 5: Test = new AVLTree(); break; default: switch_on = 0; Console.WriteLine("Nö\n"); break; } } void askSetUnsorted() { interfaceTyp = "SetUnsorted"; Console.WriteLine($"Welche Art von {interfaceTyp} möchten sie testen?"); Console.WriteLine("SetUnsortedLinkedList --> 1"); Console.WriteLine("SetUnsortedArray --> 2"); Console.WriteLine("HashTabSepChain --> 3"); Console.WriteLine("HashTabQuadProb --> 4"); try { switch_on = Convert.ToInt32(ReadLine()); } catch (System.FormatException) { switch_on = 0; } switch (switch_on) { case 1: Test = new SetUnsortedLinkedList(); break; case 2: Test = new SetUnsortedArray(); break; case 3: Test = new HashTabSepChain(); break; case 4: Test = new HashTabQuadProb(); break; default: switch_on = 0; Console.WriteLine("Nö\n"); break; } } do { Console.WriteLine("Welchen Typ möchten Sie testen?"); Console.WriteLine("MultiSetSorted --> 1"); Console.WriteLine("MultiSetUnsorted --> 2"); Console.WriteLine("SetSorted --> 3"); Console.WriteLine("SetUnsorted --> 4"); try { switch_on = Convert.ToInt32(ReadLine()); } catch (System.FormatException) { switch_on = 0; } switch (switch_on) { case 1: askMultiSetSorted(); break; case 2: askMultiSetUnsorted(); break; case 3: askSetSorted(); break; case 4: askSetUnsorted(); break; default: switch_on = 0; Console.WriteLine("Nö\n"); break; } //OP-Ausführen if (switch_on != 0) { string eingabe = ""; do { string methode = ""; op operation = null; Console.WriteLine("Welche Operation soll es denn sein? ('0' zum ändern der Struktur)"); Console.WriteLine("Einfugen --> 1"); Console.WriteLine("Suchen --> 2"); Console.WriteLine("Loschen --> 3"); Console.WriteLine("Ausgeben --> 4"); try { switch_on = Convert.ToInt32(ReadLine()); } catch (System.FormatException) { switch_on = 50; } //OP_Switch switch (switch_on) { case 1: methode = "Einfügen"; operation = new op(Test.Insert); break; case 2: methode = "Suchen"; operation = new op(Test.Search); break; case 3: methode = "Löschen"; operation = new op(Test.Delete); break; case 4: Console.WriteLine(); Test.Print(); Console.WriteLine(); break; case 0: eingabe = "OP_switch"; break; default: Console.WriteLine("Nö\n"); break; } if (operation != null) { Console.WriteLine($"Geben sie die Zahlen zum {methode} ein (zum ändern der Operation '+' drücken)"); eingabe = ReadLine(); while (eingabe != "+") { try { Console.WriteLine(operation(Convert.ToInt32(eingabe))); } catch (FormatException) { Console.WriteLine("Nur Zahlen eingeben:"); } eingabe = ReadLine(); } } }while (eingabe != "OP_switch"); } }while (true); //Endlose wiederholung }
public op Helper(string head, double tail, op op) { return(op == op.add ? Int32.Parse(head) + Convert.ToInt32(tail) : Int32.Parse(head) - Convert.ToInt32(tail)); }
public OperatorInfo(int operatorPrecedenceValue, bool rightAssociative, op compute) { this.PrecedenceValue = operatorPrecedenceValue; this.RightAssociative = rightAssociative; this.Compute = compute; }