Facebook
From aa, 1 Month ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 130
  1. #include <iostream>
  2. #include <cmath>
  3.  
  4. using namespace std;
  5.  
  6.  
  7.  
  8.  
  9. struct w{
  10.     int x_1,y_1;
  11.     int x_2,y_2;
  12. };
  13. struct poza{
  14.     int x,y,z;
  15. };
  16.  
  17. union kordynaty{
  18.     w w2;
  19.     poza w3;
  20. };
  21.  
  22. int main()
  23.  
  24.  
  25.  
  26.     kordynaty w;
  27.  
  28.     cout<<"podaj x y początkowe: "<<endl;
  29.     cin>>w.w2.x_1>>w.w2.y_1;
  30.  
  31.     cout<<"podaj x y koncowe: "<<endl;
  32.     cin>>w.w2.x_2>>w.w2.y_2;
  33.  
  34.  
  35.     cout<<"dlugosc odcinka: "<<sqrt(pow(w.w2.x_2 - w.w2.x_1, 2)+pow(w.w2.y_2-w.w2.y_1,2));
  36.  
  37.     return 0;
  38. }
  39.