Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- using namespace std;
- class Trojkat
- {
- private:
- float x, y, z, obw2, pole;
- public:
- void newTrojkat()
- {
- x=0;
- y=0;
- z=0;
- }
- void newTrojkat(Trojkat &a)
- {
- x=a.x;
- y=a.y;
- z=a.z;
- static bool SprawdzXYZ(float x, float y, float z)
- {
- if(x>0 && y>0 && z>0)
- return true;
- else return false;
- if(x<y+z || y<x+z || z<x+y)
- return true;
- else return false;
- }
- void UstawXYZ(float newx, float newy, float newz)
- {
- Trojkat a;
- a.x=newx;
- a.y=newy;
- a.z=newz;
- if(a.SprawdzXYZ())
- {
- newTrojkat(a);
- }
- }
- private:
- void ObliczObw2()
- {
- obw2=(x+y+z)/2;
- }
- void ObliczPole()
- {
- pole=2*sqrt((obw2-x)*(obw2-y)*(obw2-z));
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement