rygyfygy

Zad 10.1

May 15th, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.92 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. using namespace std;
  4.  
  5. fabs(x);
  6.  
  7.  
  8. int cwiartka(double x,double y, double r) //funkcja sprawdza, w ktorej cwiartce znajduje sie okrag
  9. {
  10.     if(r <=0.0) return 0;
  11.     if(r >= fabs(x) || r >= fabs(y)) return 0;
  12.     if(x > 0 && y > 0) return 1;
  13.     if(x < 0 && y > 0) return 2;
  14.     if(x < 0 && y < 0) return 3;
  15.     return 4;
  16. }
  17.  
  18. void zadanie1()
  19. {
  20.     int p[5] = {0,0,0,0,0};
  21.     for (int i=0; i<2000; i++)
  22.     p[cwiartka(x[i],y[i],r[i])]++;
  23.  
  24.     cout << "\nZadanie 1\n";
  25.     for (int i=1; i<=4; i++)
  26.         cout << "Cwiartka" << i << " : "<<p[i]<<"\n";
  27.  
  28.     cout << "pozostale okregi : " << p[0] << "\n";
  29. }
  30.  
  31. bool CzyParaLustrzana(double x1, y1, double r1, double x2 double y2, double r2)
  32. {
  33.     if(r1 != r2) return false;
  34.     if(x1 = x2 && y1 == -y2) return true;
  35.     if(y1 = y2 && x1 == -x2) return true;
  36.     return false;
  37. }
  38.  
  39. int main()
  40. {
  41.    
  42.    
  43.    
  44.    
  45.    
  46.    
  47.     return 0;
  48. }
Add Comment
Please, Sign In to add comment