#include<stdio.h> #include<ctype.h> #include<conio.h> #include<stdlib.h> int i=0; int a1=0 , b1=0 ,c1=0;int K=0; int detA =0 , det1 =0 , det2=0 ;int SIZE=0; float *x,*y ; int lines=0;int p=0,q=0,r=0,s=0; float x_cor =0 , y_cor =0; struct COF { int a =0,b=0,c=0,k=0; int count =0; struct COF *next; }; struct POINT { float x_cord =0 , y_cord=0; int count =0; struct POINT *next; }; void CREATE (POINT *A) } void CheckPoint(float cordx , float cordy , POINT *B) { int TESTX=0 ,TESTY=0; int FLAGX =0,FLAGY=0 ,STATUS =0; i=0; do { if( (B->x_cord <=cordx && B->next->x_cord >= cordx ) || (B->next->x_cord <= cordx && B->x_cord >=cordx ) ) { TESTX=1;} if( (B->y_cord <=cordy && B->next->y_cord >= cordy ) || (B->next->y_cord <= cordy && B->y_cord >=cordy ) ) { TESTY=1;} B=B->next; i++; } while ( B->next->count!=1 ); return; } int main(void) { struct COF *P; struct COF *REF; REF=P; POINT *XY ,*REFPOINT ; for (i=0;i<lines ;i++) { if(i==0) { else { if(i!=lines-1) { XY=XY->next; } XY->next=REFPOINT; } } } } for ( i=0;i<lines ; i++ ) { P->a=a1; P->b=b1;P->c=c1 ;P->k=-1*c1;P->count=i; a1=0 ; b1=0 ;c1=0; if(i==lines-1) { P->next=REF;} } i=0;P=REF; do { p=0,q=0,r=0,s=0; p=P->a; q=P->next->b; r=P->next->a; s=P->b; detA=p*q - r*s ; p=0;q=0;r=0;s=0; p=P->a; q=P->next->k; r=P->next->a; s=P->k; det1=p*q - r*s ; p=0;q=0;r=0;s=0; p=P->next->b; q=P->k; r=P->b; s=P->next->k; det2=p*q - r*s ; *(x+i)=float(det2)/float(detA); *(y+i)=float(det1)/float(detA) ; i++; P=P->next; } while( P->next->count != 1 ) ; XY=REFPOINT; for(i=0;i<lines;i++) { XY->x_cord=*(x+i); XY->y_cord=*(y+i); XY->count=i; XY=XY->next; } XY=REFPOINT; printf("ARE YOU SURE THE LINES IN THE ORDER FORM A REGULAR POLYGON OF %d SIDES : IF SURE ENTER 1 OTHER WISE ENTER 0 :",lines); if(K==1) { CheckPoint(x_cor,y_cor,XY); } return(0); }
Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.
Virus note: All files are scanned once-a-day by SourceCodester.com for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.
FOR YOUR OWN SAFETY, PLEASE:
1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.