Advertisement
Guest User

Untitled

a guest
May 21st, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. #define PI 3.14
  6.  
  7. class Kolo {
  8. private:
  9. double promien;
  10. public:
  11. Kolo(double r) : promien(r) {
  12. }
  13. void print() {
  14. cout <<"Promien: "<<promien<<endl;
  15. }
  16. double pole() {
  17. return PI*promien*promien;
  18. }
  19. double obwod() {
  20. return 2*PI*promien;
  21. }
  22. };
  23.  
  24.  
  25. int main(int argc, char **argv) {
  26. Kolo k1 (5);
  27. k1.print();
  28. cout<<"Pole: "<<k1.pole()<<", obwod:"<<k1.obwod()<<endl;
  29. return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement