Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<cstdlib>
- using namespace std;
- class valjak
- {
- double r,H;
- public:
- void inic(double a, double b)
- {
- r=a;
- H=b;
- }
- void citaj()
- {
- cout<<"r=";
- cin>>r;
- cout<<"H=";
- cin>>H;
- }
- void pisi()
- {
- cout<<"r="<<r<<endl;
- cout<<"H="<<H<<endl;
- }
- double povrsina();
- double zapremina();
- double poredi();
- };
- double valjak::povrsina()
- {
- double p;
- p=2*r*r*3.14+2*r*3.14*H;
- return p;
- }
- double valjak::zapremina()
- {
- double v;
- v=r*r*3.14*H;
- return v;
- }
- double valjak::poredi(double e)
- {
- if(s.zapremina>e) return s.zapremina;
- else return e;
- }
- int main()
- {
- valjak s,p;
- double k,j,por;
- s.citaj();
- s.pisi();
- k=s.povrsina();
- cout<<"P="<<k<<endl;
- k=s.zapremina();
- cout<<"V="<<k<<endl;
- p.citaj();
- por=s.poredi(p.zapremina);
- cout<<por;
- system("PAUSE");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement