Advertisement
VEGASo

Lab #2 Ex. 1

Sep 15th, 2022
773
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.74 KB | Source Code | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5.  
  6.  
  7. double RToL(int R, double Pi)
  8. {
  9.     return 2 * Pi * R;
  10. }
  11.  
  12. double RToS(int R, double Pi)
  13. {
  14.     return Pi * R * R;
  15. }
  16.  
  17. double RToSp(double Pi, int R)
  18. {
  19.     return 4 * Pi * R * R;
  20. }
  21.  
  22. double RToV(int R, double Pi)
  23. {
  24.     return 1 / 3 * Pi * R * R * R;
  25. }
  26.  
  27.  
  28. int main()
  29. {
  30.     setlocale(LC_ALL, "Russian");
  31.  
  32.     int L = 0, R = 0, S = 0;
  33.     double Pi = 3.14;
  34.  
  35.     cout << "Величина радиуса: ";
  36.     cin >> R;
  37.  
  38.     cout << "Длина окружности: " << RToL(R, Pi) << endl;
  39.     cout << "Площадь окружности: " << RToS(R, Pi) << endl;
  40.     cout << "Площадь поверхности сферы: " << RToSp(R, Pi) << endl;
  41.     cout << "Обьем сферы: " << RToV(R, Pi) << endl;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement