Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cmath>
- #include <iostream>
- #include <iomanip>
- #include <conio.h>
- #include <math.h>
- using namespace std;
- double x[4], y[4], max=-1000000, perimetras, plotas, d1, d2, d3, d4;
- void Staciakampis()
- {
- d1=sqrt(pow(x[1]-x[0],2)+pow(y[1]-y[0],2));
- d2=sqrt(pow(x[2]-x[1],2)+pow(y[2]-y[1],2));
- d3=sqrt(pow(x[3]-x[2],2)+pow(y[3]-y[2],2));
- d4=sqrt(pow(x[0]-x[3],2)+pow(y[0]-y[3],2));
- perimetras = d1+d2+d3+d4;
- plotas = d1*d2;
- cout<<fixed<<setprecision(5)<<plotas<<endl;
- cout<<fixed<<setprecision(5)<<perimetras<<endl;
- }
- int main()
- {
- for(int i=0;i<4;i++)
- {
- cin>>x[i];
- cin>>y[i];
- if(x[i] > max)
- {
- max = x[i];
- }
- if(y[i] > max)
- {
- max = y[i];
- }
- }
- Staciakampis();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement