Advertisement
BORUTO-121

eraseAngles_betw_x&y

Sep 6th, 2021
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.79 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<math.h>
  3.  
  4. const double pi=4*atan(1);
  5.  
  6. struct Ugao {
  7.   int stepeni, minute, sekunde;
  8. };
  9.  
  10. double toRad(struct Ugao kut){
  11.   return pi*(kut.stepeni+kut.minute/60.+kut.sekunde/3600.)/180.;
  12. }
  13.  
  14. int izbaci(struct Ugao *uglovi, int vel, double x, double y){
  15.   int i;
  16.   for(i=0;i<vel;i++){
  17.     if(toRad(uglovi[i])>=x && toRad(uglovi[i])<=y){
  18.       int j=i;
  19.       for(;j<vel-1;j++)
  20.         uglovi[j]=uglovi[j+1];
  21.       vel--;
  22.       i--;
  23.     }
  24.   }
  25.   return vel;
  26. }
  27.  
  28. int main(){
  29.   //printf("%lf, %lf",toRad((struct Ugao){150,0,0}),pi);return 1;
  30.   struct Ugao kut[5]={{5,43,46},{5,43,47},{11,27,34},{11,27,32},{30,30,30}};
  31.   int vel=izbaci(kut,5,.1,.2);
  32.   int i=0;
  33.   for(;i<vel;i++)
  34.     printf("%d %d %d\n",kut[i].stepeni,kut[i].minute,kut[i].sekunde);
  35.   return 0;
  36. }
  37.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement