Advertisement
plamen5rov

Untitled

Jun 9th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     double x1, y1, x2, y2, wideth, lenght, area, perimeter;
  9.    
  10.    
  11.     cin >> x1;
  12.     cin >> y1;
  13.     cin >> x2;
  14.     cin >> y2;
  15.     wideth = abs(x1 - x2);
  16.     lenght = abs(y1 - y2);
  17.    
  18.     area = wideth * lenght;
  19.     perimeter = 2 * (wideth + lenght);
  20.     cout.setf(ios::fixed);
  21.     cout.precision(2);
  22.     cout <<  area << endl << perimeter << endl;
  23.    
  24.     return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement