Advertisement
a53

IntersectieGraficeFunctii

a53
Jul 29th, 2021
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4. float a, b, c, d, p1,p2;
  5.  
  6. int main()
  7. {
  8. cin>>a>>b>>c>>d;
  9. if(a==c && b!=d)
  10. cout<<"Grafice paralele";
  11. else if(a==c && b==d)
  12. cout<<"Grafice echivalente";
  13. else
  14. {
  15. p1=(d-b)/(a-c);
  16. p2=a*p1+b;
  17. cout<<fixed<<setprecision(2)<<(p1*100)/100<<" "<<(p2*100)/100;
  18. }
  19. return 0;
  20. }
  21. /**
  22. SO
  23. #include <iostream>
  24. using namespace std;
  25. int main()
  26. {
  27. double a,b,c,d;
  28. cin>>a>>b>>c>>d;
  29. if(a==c && b==d)
  30. cout<<"Grafice echivalente";
  31. else if(a==c && b!=d)
  32. cout<<"Grafice paralele";
  33. else
  34. {
  35. double x=(d-b)/(a-c),y=a*((d-b)/(a-c))+b;
  36. int X=x*100,Y=y*100;
  37. if(X<0)
  38. cout<<"-",X=-X;
  39. cout<<X/100<<"."<<X/10%10<<X%10<<" ";
  40. if(Y<0)
  41. cout<<"-",Y=-Y;
  42. cout<<Y/100<<"."<<Y/10%10<<Y%10;
  43. }
  44. return 0;
  45. }
  46. */
  47.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement