evcamels

lab1_new

Dec 16th, 2021
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include <string>
  4. using namespace std;
  5. class triangle{
  6. float a,b,c;
  7. public:
  8. void set(float a, float b, float c){
  9. this->a = a;
  10. this->b = b;
  11. this->c = c;
  12. }
  13. void _info(){
  14. float p = (a+b+c)/2;
  15. cout << "Сторона а: " << a << endl;
  16. cout << "Сторона b: " << b << endl;
  17. cout << "Сторона c: " << c << endl;
  18. cout << "Периметр: " << a+b+c << endl;
  19. cout << "Площадь: " << sqrt(p*(p-a)*(p-b)*(p-c)) << endl;
  20. }
  21. float uv_A(float uvel){
  22. return uvel*a;
  23. }
  24. float uv_B(float uvel){
  25. return uvel*b;
  26. }
  27. float uv_C(float uvel){
  28. return uvel*c;
  29. }
  30. void _uvel(float uvel){
  31. cout << "Увеличили стороны в " << uvel << " раз: " << endl;
  32. cout << "Сторона А: " << uv_A(uvel) << endl;
  33. cout << "Сторона B: " << uv_B(uvel) << endl;
  34. cout << "Сторона C: " << uv_C(uvel) << endl;
  35. }
  36. float angle_A(){
  37. return acos((b*b+c*c-a*a)/(2*b*c)) * 180 / 3.14;
  38. }
  39. float angle_B(){
  40. return acos((b*b+c*c-a*a)/(2*b*c)) * 180 / 3.14;
  41. }
  42. float angle_C(){
  43. return acos((b*b+c*c-a*a)/(2*b*c)) * 180 / 3.14;
  44. }
  45. void _angle(){
  46. cout << "Угол А: " << angle_A() << endl;
  47. cout << "Угол B: " << angle_B()<< endl;
  48. cout << "Угол С: " << angle_C()<< endl;
  49. }
  50. };
  51. int main(){
  52. triangle tr;
  53. float a,b,c;
  54. cout << "Введите стороны треугольника: ";
  55. cin >> a >> b >> c;
  56. tr.set(a,b,c);
  57. tr._info();
  58. cout << "Введите в какой кол-во раз увеличить стороны: ";
  59. float u;
  60. cin >> u;
  61. tr._uvel(u);
  62. tr._angle();
  63. return 0;
  64. }
  65.  
Advertisement
Add Comment
Please, Sign In to add comment