Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.77 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Globalization;
  4.  
  5. namespace Lab2
  6. {
  7. internal class Program
  8. {
  9. public delegate double FuncValue(double x);
  10. public static void Main(string[] args)
  11. {
  12. FuncValue funcpointer = new FuncValue(Func1);
  13. int numb;
  14. double n = 0;
  15. double confines1, confines2, inaccuracy;
  16. RectangleMethod solution = new RectangleMethod();
  17. UI ui = new UI();
  18.  
  19. numb = ui.SelectFunc();
  20. ui.Confines(out confines1,out confines2);
  21. inaccuracy = ui.Inaccuracy();
  22.  
  23. switch (numb)
  24. {
  25. case 1:
  26. n = solution.work(confines1,confines2,inaccuracy,funcpointer);
  27. break;
  28. case 2:
  29. funcpointer = Func2;
  30. n = solution.work(confines1,confines2,inaccuracy,funcpointer);
  31. break;
  32. case 3:
  33. funcpointer = Func3;
  34. n = solution.work(confines1,confines2,inaccuracy,funcpointer);
  35. break;
  36. default:
  37. UI.Err(4);
  38. break;
  39. }
  40. UI.OutResult(n);
  41. }
  42.  
  43. public static double Func1( double x)
  44. {
  45. return 2*Math.Pow(x,2) + 3*x - 1;
  46. }
  47.  
  48. public static double Func2( double x)
  49. {
  50. return (Math.Sin(x))/(Math.Pow(Math.Cos(x),2)+1);
  51. }
  52.  
  53. public static double Func3( double x)
  54. {
  55. return x* Math.Sqrt(Math.Pow(x,2)+9);
  56. }
  57.  
  58. }
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement