Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.45 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int isInside(int bod_x, int bod y)
  4. {
  5.    
  6.     /* kontrola zda bod uvnitr */
  7.    
  8.     return (0);
  9. }
  10.  
  11.  
  12.  
  13. int isPolygon(int x1,int y1,int x4,int y4)
  14. {
  15.    
  16.     /* jednotlive strany se nesmeji protinat , vraci 1 v pripade ze neni n-uhelnik */
  17.    
  18.    
  19.     return (0);
  20. }
  21.  
  22.  
  23. int main (void)
  24. {
  25.     int bod_x, bod_y, sour[8], i=6;
  26.    
  27.     printf("Zadejte souradnice bodu:\n");
  28.     if(scanf("%d %d",&bod_x,&bod_y)!=2)
  29.     {
  30.         printf("Nespravny vstup.\n");
  31.         return (1);                     /*  nespravny vstup - spatne zadane souradnice bodu  */
  32.     }
  33.  
  34.     printf("Zadejte body n-uhelniku:\n");
  35.  
  36.     if(scanf("%d %d",&sour[0],&sour[1]))
  37.     {
  38.         printf("Nespravny vstup.\n");
  39.         return (1);                     /*  nespravny vstup - spatne zadane souradnice bodu nebo nedostatek souradnic  */
  40.     }
  41.  
  42.     if(scanf("%d %d",&sour[2],&sour[3]))
  43.     {
  44.         printf("Nespravny vstup.\n");
  45.         return (1);                     /*  nespravny vstup - spatne zadane souradnice bodu nebo nedostatek souradnic  */
  46.     }
  47.  
  48.     if(scanf("%d %d",&sour[4],&sour[5]))
  49.     {
  50.         printf("Nespravny vstup.\n");
  51.         return (1);                     /*  nespravny vstup - spatne zadane souradnice bodu nebo nedostatek souradnic  */
  52.     }
  53.  
  54.     while(1)
  55.     {
  56.         if(scanf("%d %d",&sour[i++],&sour[i++]))
  57.         {
  58.             printf("Nespravny vstup.\n");
  59.             return (1);
  60.         }
  61.    
  62.         i%=8;
  63.        
  64.         if(isPolygon(sour[0],sour[1],sour[6],sour[7]))
  65.         {
  66.             printf("Zadane body netvori n-uhelnik\n");
  67.             return (1);
  68.         }
  69.        
  70.         if(feof(stdin))                 /* konec vstupu */
  71.             isInside(bod_x,bod_y);
  72.     }
  73.  
  74.     return (0);
  75. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement