Advertisement
VEGASo

Lab #2 Ex. 1

Oct 25th, 2022
600
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.21 KB | None | 0 0
  1. /////////////////////////////////////////////////LearnRSU.cpp
  2. #include <iostream>
  3. #include "sphere.h"
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.     setlocale(LC_ALL, "Russian");
  10.     double R = 0;
  11.  
  12.     cout << "Величина радиуса: ";
  13.     cin >> R;
  14.  
  15.     cout << "Длина окружности: " << RToL(R) << endl;
  16.     cout << "Площадь окружности: " << RToS(R) << endl;
  17.     cout << "Площадь поверхности сферы: " << RToSp(R) << endl;
  18.     cout << "Обьем сферы: " << RToV(R) << endl;
  19. }
  20. //////////////////////////////////////////////////
  21.  
  22.  
  23.  
  24. //////////////////////////////////////////////////sphere.cpp
  25. #include "sphere.h"
  26.  
  27. double Pi = 3.14;
  28.  
  29. double RToL(int R)
  30. {
  31.     return 2 * Pi * R;
  32. }
  33.  
  34. double RToS(int R)
  35. {
  36.     return Pi * R * R;
  37. }
  38.  
  39. double RToSp(int R)
  40. {
  41.     return 4 * Pi * R * R;
  42. }
  43.  
  44. double RToV(int R)
  45. {
  46.     return Pi * R * R * R * 1 / 3;
  47. }
  48. //////////////////////////////////////////////////
  49.  
  50.  
  51.  
  52. //////////////////////////////////////////////////sphere.h
  53. #ifndef SPHERE_H; // или #programa once
  54. #define SPHERE_H;
  55.  
  56.  
  57. double RToL(int);
  58. double RToS(int);
  59. double RToSp(int);
  60. double RToV(int);
  61.  
  62.  
  63. #endif;
  64. //////////////////////////////////////////////////
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement