Advertisement
Guest User

Untitled

a guest
Mar 20th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3. #include <iomanip> // для setprecision
  4. #include <string>
  5. #include <Windows.h>
  6. using namespace std;
  7.  
  8. class Points //класс точки
  9. {
  10. public:
  11. int x1, x2, y1, y2;//поля координат
  12. {
  13. public:
  14. Look(); // конструктор
  15. {
  16.  
  17. cout << "Введите координату x1: ";
  18. cin << x1;
  19. cout << "Введите координату x2: ";
  20. cin << x2;
  21. cout << "Введите координату y1: ";
  22. cin << y1 ;
  23. cout << "Введите координату y2: ";
  24. cin << y2;
  25. }
  26. }
  27. void Print()
  28. {
  29. cout << "x1 : " << x1 << endl;
  30. cout << "x2 : " << x2 << endl;
  31. cout << "y1 : " << y1 << endl;
  32. cout << "y1 : " << y2 << endl;
  33. }
  34. ~Look();
  35. class Cut :public Points;
  36. {
  37. constr();
  38. public:
  39. {
  40. float d();
  41. {
  42. sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1 - y2))
  43. }
  44.  
  45. }
  46. class Vektor :public Points;
  47. {
  48. int z1, z2;
  49. public:
  50. Vektor()
  51. {
  52. cout << "Введите координату z1: ";
  53. cin << z1;
  54. cout << "Введите координату z2: ";
  55. cin << z2;
  56. }
  57. void Print_Vektor()
  58. {
  59. cout << "Координаты вектора в пространстве: (" << x1 << x2 << y1 << y2 << z1 << z2 << ")" << endl;
  60. }
  61. void Krd_Vektor()
  62. {
  63. cout << x2 - x1 << " " << y2 - y1 << " " << z2 - z1;
  64. }
  65. int main()
  66. {
  67. setlocale(LC_ALL, "rus");
  68. Points points;
  69. cout << "Координаты точек: ";
  70. points.Look;
  71. cout << "Отрезок: ";
  72. Cut сut;
  73. cout << " Длина Отрезка: ";
  74. cut.d();
  75. Vektor vektor;
  76. cout << " Координаты концов векторов: ";
  77. vektor.Print_Vektor();
  78. cout << " Координаты векторов: ";
  79. vektor.Krd_Vektor();
  80. system("pause");
  81. }
  82. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement