Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<cmath>
- using namespace std;
- class stozek {
- private:
- float h;
- float r;
- float L;
- private:
- void Zwrot_L()
- {
- L = sqrt(h*h + r*r);
- }
- public:
- float Objetosc;
- float Polepc;
- stozek(float h, float r)
- {
- h = h;
- r = r;
- Zwrot_L();
- }
- stozek(float h_, float r_, float l_)
- {
- h = h_;
- r = r_;
- L = l_;
- }
- float Ppc()
- {
- Polepc = ((3.14*(r*r)) + (3.14*r*L));
- return Polepc;
- }
- float V()
- {
- Objetosc = ((3.14*(r*r)*h) / 3);
- return Objetosc;
- }
- float zwort_L()
- {
- return L;
- }
- };
- int main() {
- float h_1, r_1;
- cout << "Podaj h i r" << endl;
- cin >> h_1 >> r_1;
- stozek s1(3, 4, 5);
- stozek s2(h_1, r_1);
- cout << "V=" << s1.V() << endl;
- cout << "PPc=" << s1.Ppc() << endl;
- cout << "tworz=" << s1.zwort_L() << endl;
- cout << "V=" << s2.V() << endl;
- cout << "PPc=" << s2.Ppc() << endl;
- cout << "tworz=" << s2.zwort_L() << endl;
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement