Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.89 KB | None | 0 0
  1. using System;
  2.  
  3.  
  4. namespace task_3
  5. {
  6. class Polynomial2
  7. {
  8. public double a, b, c, x;
  9. public double A
  10. {
  11. set
  12. {
  13. if (!double.TryParse(Console.ReadLine(), out a))
  14. A = value;
  15. else Console.WriteLine("Неккоректные данные");
  16. }
  17. }
  18. public double B
  19. {
  20. set
  21. {
  22. if (!double.TryParse(Console.ReadLine(), out b))
  23. B = value;
  24. else Console.WriteLine("Неккоректные данные");
  25. }
  26. }
  27. public double C
  28. {
  29. set
  30. {
  31. if (!double.TryParse(Console.ReadLine(), out c))
  32. C = value;
  33. else Console.WriteLine("Неккоректные данные");
  34. }
  35. }
  36. public double X
  37. {
  38. set
  39. {
  40. if (!double.TryParse(Console.ReadLine(), out x))
  41. X = value;
  42. else Console.WriteLine("Неккоректные данные");
  43. }
  44. }
  45. /* public Polynomial2(double a, double b, double c, double x)
  46. {
  47. if (!double.TryParse(Console.ReadLine(), out a))
  48. {
  49. this.a = Console.ReadLine();
  50. }
  51. this.b = Console.ReadLine();
  52. this.c = Console.ReadLine();
  53. this.x = Console.ReadLine();
  54. }
  55. } */
  56. class Program
  57. {
  58. static void Main(string[] args)
  59. {
  60. Polynomial2 koef = new Polynomial2();
  61. Console.WriteLine(koef.a);
  62. Console.WriteLine(koef.b);
  63. Console.WriteLine(koef.c);
  64. Console.WriteLine(koef.x);
  65. }
  66. }
  67. }
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement