Advertisement
Guest User

Untitled

a guest
Jan 14th, 2020
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.32 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5. void okregiStyczne(int y1, int y2, int x1, int x2, int r1, int r2){
  6.  
  7. if(y1!=y2){
  8. int bokx = x1-x2;
  9. int boky = y1-y2;
  10. float bokz = sqrt(bokx*bokx+boky*boky);
  11. if(bokz == r1+r2){
  12. cout << "trojkaty styczne zewnetrznie"<<endl;
  13. }
  14. }
  15. if(abs(x1-x2) == r1 + r2){
  16. cout << "trojkaty styczne zewnetrznie"<<endl;
  17. }
  18. if(y1!=y2){
  19. int bokx = x1-x2;
  20. int boky = y1-y2;
  21. float bokz = sqrt(bokx*bokx+boky*boky);
  22. if(bokz == abs(r1-r2)){
  23. cout << "trojkaty styczne wewnetrznie"<<endl;
  24. }
  25. }
  26. if(abs(x1-x2) == abs(r1 - r2)){
  27. cout << "trojkaty styczne wewnetrznie"<<endl;
  28. }
  29.  
  30. }
  31.  
  32. void okregiWspolsrodkowe(int x1, int x2, int y1, int y2){
  33. if(x1==x2 && y1 == y2){
  34. cout<<"okregi maja wspolny srodek" <<endl;
  35. }
  36. }
  37.  
  38. void okregiRozlaczne(int x1, int x2, int y1, int y2, int r1, int r2){
  39. if(y1!=y2){
  40. int bokx = x1-x2;
  41. int boky = y1-y2;
  42. float bokz = sqrt(bokx*bokx+boky*boky);
  43. if(bokz<abs(r1-r2)){
  44. cout<<"okregi rozlaczne wewnetrznie"<<endl;
  45. }else if(bokz>r1+r2){
  46. cout<<"okregi rozlaczne zewnetrznie"<<endl;
  47. }
  48. }
  49. if(abs(x1-x2)<abs(r1-r2)){
  50. cout<<"okregi rozlaczne wewnetrznie"<<endl;
  51. }else if(abs(x1-x2)>r1+r2){
  52. cout<<"okregi rozlaczne zewnetrznie"<<endl;
  53. }
  54. }
  55.  
  56. void okregiPrzecinajace(int x1, int x2, int y1, int y2, int r1, int r2){
  57. if(y1!=y2){
  58. int bokx = x1-x2;
  59. int boky = y1-y2;
  60. float bokz = sqrt(bokx*bokx+boky*boky);
  61.  
  62. if(abs(r1-r2)<bokz && bokz < r1 + r2 ){
  63. cout<<"okregi przecinajace sie w dwoch punktach"<<endl;
  64. }
  65. }
  66. }
  67.  
  68. int main(){
  69.  
  70. int x1,x2,y1,y2,r1,r2;
  71. cout << "Podaj wspolrzedne srodka 1 kola" << endl;
  72. cin>>x1;
  73. cin>>y1;
  74. cout << "podaj promien 1 kola" << endl;
  75. cin>>r1;
  76. cout<<"podaj wspolrzedne srodka 2 kola" << endl;
  77. cin>>x2;
  78. cin>>y2;
  79. cout<<"podaj promien 2 kola" << endl;
  80. cin>>r2;
  81.  
  82. okregiStyczne(y1,y2,x1,x2,r1,r2);
  83. okregiWspolsrodkowe(x1,x2,y1,y2);
  84. okregiPrzecinajace(y1,y2,x1,x2,r1,r2);
  85. okregiRozlaczne(y1,y2,x1,x2,r1,r2);
  86.  
  87. return 0;
  88. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement