Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include <iomanip>
- #include<cmath>
- using namespace std;
- int POLE_TROJKATA(float a, float h)
- {
- float pole;
- pole=(a*h)/2;
- cout << pole;
- }
- float odcinek(float x1, float y1, float x2, float y2)
- {
- return sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
- }
- int main()
- {
- int a,h;
- cout << "ZADANIE 19"<<endl;
- cout << "Podaj bok trojkata: ";
- cin >>a;
- cout << "Podaj wysokosc trojkata: ";
- cin >>h;
- POLE_TROJKATA(a,h);
- cout << endl;
- cout << "ZADANIE 20" << endl;
- float x1,y1,x2,y2,x3,y3,d,e,f,po,pt;
- cout << "x1=";
- cin >>x1;
- cout << "y1=";
- cin >>y1;
- cout << "x2=";
- cin >>x2;
- cout << "y2=";
- cin >>y2;
- cout << "x3=";
- cin >>x3;
- cout << "y3=";
- cin >>y3;
- d=odcinek(x1,y1,x2,y2);
- e=odcinek(x2,y2,x3,y3);
- f=odcinek(x3,y3,x1,y1);
- po=(d+e+f)/2;
- pt=sqrt(po*(po-d)*(po-e)*(po-f));
- cout << "Pole trojkata wynosi: " << pt;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment