Advertisement
Josif_tepe

Untitled

Oct 21st, 2023
581
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.59 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. class kruznica {
  4. private:
  5.     double radius;
  6.     const double PI = 3.14159;
  7.    
  8. public:
  9.     kruznica() {
  10.        
  11.     }
  12.     kruznica(double _radius) {
  13.         radius = _radius;
  14.     }
  15.     void set_radius(double _radius) {
  16.         radius = _radius;
  17.     }
  18.     double get_radius() {
  19.         return radius;
  20.     }
  21.     double get_PI() const {
  22.         return PI;
  23.     }
  24.     double presmetaj_perimetar() const {
  25.         return 2 * radius * PI;
  26.     }
  27. };
  28.  
  29. int main() {
  30.     kruznica k(5.6);
  31.    
  32.     cout << k.get_PI() << endl;
  33.     return 0;
  34. }
  35.  
  36.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement