private void Solution_btn_Click(object sender, EventArgs e) { Solving solving = new Solving(this.max, this.test); sln = solving.Resolve(); timerAutoRun.Start(); }
public void GetCoffOfQuadraticEq() { Console.WriteLine("You chose the quadratic type of equation and you should enter three coefficients, a, d and c (integer or real numbers):\n" + "ax^2+bx+c=0"); Console.WriteLine("Enter the first coefficient: "); double a = CheckTheDouble(); Console.WriteLine("Enter the second coefficient: "); double b = CheckTheDouble(); Console.WriteLine("Enter the third coefficient: "); double c = CheckTheDouble(); Solving trySolve = new Solving(a, b, c); String solving = trySolve.FindRoots(); Logg log = new Logg(); String line = "The user chose the quadratic type of equation and entered following coefficients:\r\n" + $"a={a}, b = {b} and c = {c}\r\nThe equation: {a}x^2+{b}x+{c}=0\r\nThe result is: " + solving; log.WriteInAFile(line); Console.WriteLine(solving); }
private void BE_Click(object sender, RoutedEventArgs e) { Calcu.Input = Result.Content.ToString(); Calcu.Input = Calcu.Input.Replace(".", ","); Calcu.Lstring = Parse.makeList(Calcu.Input); try { bool valid = Calcu.Validate(Calcu.Lstring); if (Calcu.Lstring.Count != 1) { Calcu.Hasil = Solving.solver(Calcu.Lstring).ToString(); Calcu.Hasil = Calcu.Hasil.Replace(",", "."); Result.Content = Calcu.Hasil; Calcu.Ans = Calcu.Hasil; } else { Calcu.Ans = Calcu.Input.Replace(",", "."); } } catch (InvalidExpression Error) { Result.Content = Error.Message; } }
public async Task AssignExerciseToUsers(int GroupId, int ExerciseId, AssignExerciseVM assignExerciseVM) { var assignments = await groupRepository.getMembers(GroupId); var exercise = await context.Exercises.FirstOrDefaultAsync(x => x.ExerciseId == ExerciseId); foreach (var item in assignments) { if (userService.CheckIfUserHasPermission("Wykonanie zadania", GroupId, item.UserId) == true) { var newSolving = new Solving() { AssignmentId = item.AssignmentId, Status = "Do wykonania", CreatedAt = DateTime.Now, ProgrammingLanguage = "Not now", Exercise = exercise, ExerciseId = ExerciseId, DeadLine = DateTime.ParseExact(assignExerciseVM.DeadLineString, "dd-MM-yyyy HH:mm", System.Globalization.CultureInfo.InvariantCulture), SentAt = DateTime.MinValue, Configuration = assignExerciseVM.Configuration }; await context.Solvings.AddAsync(newSolving); await context.SaveChangesAsync(); } } }
public void GetCoffOfLinearEq() { Console.WriteLine("You chose the linear type of equation and you should enter two coefficients, a and d (integer or real numbers):\n" + "ax+b=0"); Console.WriteLine("Enter the first coefficient: "); double b = CheckTheDouble(); Console.WriteLine("Enter the second coefficient: "); double c = CheckTheDouble(); Solving trySolve = new Solving(0, b, c); String solving = trySolve.FindRoots(); Logg log = new Logg(); String line = "The user chose the linear type of equation and entered following coefficients:\r\n" + $"a={b} and b = {c}\r\nThe equation: {b}x+{c}=0\r\nThe result is: " + solving; log.WriteInAFile(line); Console.WriteLine(solving); }
static void Main(string[] args) { Calculator Calcu = new Calculator(); /* * Testing Kalkulasi * 1) 2+3 * 2) 2-3 * 3) 10:2 * 4) 10.5x2.3 * 5) √99 * 6) -5+-5 * 7) 5x-10 * 8) √10+10 * 9) -10+5x-10--5 * 10) -10+-5:10--5 * 11) 20+-10+√100 * 12) -30-100:10+-10+√1000 * * Testing Exception * 1) 10:0 * 2) √-10 * 3) +5-3 * 4) 5++2 * 5) 12-98- * 6) 12-+32 * 7) 10√ * 8) √:10 * 9) 10.12√2 * 10) 10.2.3 * */ Calcu.Input = "-30-100:10+-10+√1000"; Console.WriteLine("Input : " + Calcu.Input); Calcu.Input = Calcu.Input.Replace(".", ","); Calcu.Lstring = Parse.makeList(Calcu.Input); //Testing parse Console.WriteLine("\nHasil Parse Input"); foreach (var elmt in Calcu.Lstring) { Console.WriteLine(elmt); } try { bool valid = Calcu.Validate(Calcu.Lstring); if (Calcu.Lstring.Count != 1) { Calcu.Hasil = Solving.solver(Calcu.Lstring).ToString(); Calcu.Hasil = Calcu.Hasil.Replace(",", "."); Console.WriteLine("\nHasil : " + Calcu.Hasil); Calcu.Ans = Calcu.Hasil; } else { Calcu.Ans = Calcu.Input.Replace(",", "."); } } catch (InvalidExpression Error) { Console.WriteLine("Hasil : " + Error.Message); } // Testing Expression double Num1 = 5; double Num2 = 4; Console.WriteLine("\nTestingExpression"); AddExpression <dynamic> E = new AddExpression <dynamic>(new TerminalExpression <dynamic>(Num1), new TerminalExpression <dynamic>(Num2)); Console.WriteLine("Terminal Ekspression 1 : " + Num1); Console.WriteLine("Terminal Ekspression 2 : " + Num2); Console.WriteLine("Hasil AddExpression : " + E.solve()); SubstractExpression <dynamic> E2 = new SubstractExpression <dynamic>(new TerminalExpression <dynamic>(Num1), new TerminalExpression <dynamic>(Num2)); Console.WriteLine("\nTerminal Ekspression 1 : " + Num1); Console.WriteLine("Terminal Ekspression 2 : " + Num2); Console.WriteLine("Hasil SubstractExpression : " + E2.solve()); MultiplyExpression <dynamic> E3 = new MultiplyExpression <dynamic>(new TerminalExpression <dynamic>(Num1), new TerminalExpression <dynamic>(Num2)); Console.WriteLine("\nTerminal Ekspression 1 : " + Num1); Console.WriteLine("Terminal Ekspression 2 : " + Num2); Console.WriteLine("Hasil MultiplyExpression : " + E3.solve()); DivideExpression <dynamic> E4 = new DivideExpression <dynamic>(new TerminalExpression <dynamic>(Num1), new TerminalExpression <dynamic>(Num2)); Console.WriteLine("\nTerminal Ekspression 1 : " + Num1); Console.WriteLine("Terminal Ekspression 2 : " + Num2); Console.WriteLine("Hasil DivideExpression : " + E4.solve()); NegativeExpression <dynamic> E5 = new NegativeExpression <dynamic>(new TerminalExpression <dynamic>(Num1)); Console.WriteLine("\nTerminal Ekspression 1 : " + Num1); Console.WriteLine("Hasil NegativeExpression : " + E5.solve()); RootExpression <dynamic> E6 = new RootExpression <dynamic>(new TerminalExpression <dynamic>(Num1)); Console.WriteLine("\nTerminal Ekspression 1 : " + Num1); Console.WriteLine("Hasil RootExpression : " + E6.solve()); Console.ReadLine(); }
public dynamic solver(List <string> input) { return(Solving.solver(input)); }
void Start() { map = new int[7, 11]; blocks = new GameObject[7, 11]; for (int i = 1; i < map.GetLength(0) - 1; i += 1) { for (int j = 1; j < map.GetLength(1) - 1; j += 1) { if ((i % 2 == 0 && j % 2 == 1) || (i % 2 == 1 && j % 2 == 0) || (i % 2 == 0 && j % 2 == 0)) { blocks[i, j] = GameObject.Find("tale_" + i + "_" + j); } } } for (int i = 0; i < map.GetLength(0); i += 1) { for (int j = 0; j < map.GetLength(1); j += 1) { if (i == 0 || i == map.GetLength(0) - 1 || j == 0 || j == map.GetLength(1) - 1 || (i % 2 == 0 && j % 2 == 0)) { map[i, j] = 1; } } } divide3(map, true, 0, 6, 0, 10); for (int i = 1; i < map.GetLength(0) - 1; i += 1) { for (int j = 1; j < map.GetLength(1) - 1; j += 1) { if (i % 2 == 0 && j % 2 == 0) { if (map[i - 1, j] == 0 && map[i, j - 1] == 0 && map[i + 1, j] == 0 && map[i, j + 1] == 0) { map[i, j] = 0; } } } } for (int i = 1; i < map.GetLength(0) - 1; i += 1) { for (int j = 1; j < map.GetLength(1) - 1; j += 1) { if ((i % 2 == 0 && j % 2 == 1) || (i % 2 == 1 && j % 2 == 0) || (i % 2 == 0 && j % 2 == 0)) { if (map[i, j] == 0) { Destroy(blocks[i, j]); } } } } Solving solving = new Solving(map); }