B4l4nc3
Network Intelligence Aggregator
2
MONTHS
2 2 MONTHS OF SERVICE
LEVEL 1
400 XP
This project will teach you how to get intersection of random two lines from a set of N lines. It was created using C/C++. This is very easy to do project. Download the project to see the full source code/
Please don't forget to like my page.
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.
Download
Please don't forget to like my page.
- #include<stdio.h>
- #include<ctype.h>
- #include<conio.h>
- #include<stdlib.h>
- int
i=
0
;
- int
a1=
0
,
b1=
0
,
c1=
0
;
- int
detA =
0
,
det1 =
0
,
det2=
0
;
int
l1=
0
,
l2=
0
;
- float
x=
0
,
y=
0
;
int
lines ;
int
p=
0
,
q=
0
,
r=
0
,
s=
0
;
- struct
COF {
- int
a =
0
,
b=
0
,
c=
0
,
k=
0
;
- int
count =
0
;
- struct
COF *
next;
- }
;
- COF AccessLine(
COF *
A,
int
m)
- {
- do
- {
- if
(
A->
count==
m-
1
)
{
return
*
A;
}
- else
{
A=
A->
next ;
}
- }
- while
(
A->
next->
count!=
1
)
;
- }
- int
main(
void
)
- {
- struct
COF *
P;
- P=
(
COF *
)
malloc
(
sizeof
(
COF)
)
;
- struct
COF *
REF;
- REF=
(
COF *
)
malloc
(
sizeof
(
COF)
)
;
- REF=
P;
- printf
(
"Number of lines N= "
)
;
- scanf
(
"%d"
,&
lines)
;
- for
(
i=
0
;
i<
lines ;
i++
)
- {
- printf
(
"Enter the Coficients of %d th line \n
"
,
i+
1
)
;
- printf
(
"Enter a[%d] = "
,
i)
;
- scanf
(
"%d"
,&
a1)
;
- printf
(
"Enter b[%d] = "
,
i)
;
- scanf
(
"%d"
,&
b1)
;
- printf
(
"Enter c[%d] = "
,
i)
;
- scanf
(
"%d"
,
&
c1)
;
- P->
a=
a1;
P->
b=
b1;
P->
c=
c1 ;
P->
k=-
1
*
c1;
P->
count=
i;
- a1=
0
;
b1=
0
;
c1=
0
;
- P->
next=
(
COF *
)
malloc
(
sizeof
(
COF)
)
;
- if
(
i==
lines-
1
)
{
P->
next=
REF;
}
- else
{
printf
(
"VALUE OF i is %d : \n
"
,
i)
;
P=
P->
next;
}
- }
- printf
(
"CIRCULAR LINKED LIST OR COEFICIENT LIST IS CREATED :PREE ANY LEY ... \n
"
)
;
- getch
(
)
;
- printf
(
"ENTER THE LINE NUMBER FOR LINE1 IN BETWEEN 1 AND %d : "
,
lines)
;
- scanf
(
"%d"
,&
l1)
;
- printf
(
"ENTER THE LINE NUMBER FOR LINE2 IN BETWEEN 1 AND %d : "
,
lines)
;
- scanf
(
"%d"
,&
l2)
;
- COF *
LINE1=
(
COF *
)
malloc
(
sizeof
(
COF)
)
;
- COF *
LINE2=
(
COF *
)
malloc
(
sizeof
(
COF)
)
;
- P=
REF;
- *
LINE1=
AccessLine(
P,
l1)
;
- P=
REF;
- *
LINE2=
AccessLine(
P,
l2)
;
- printf
(
"SUCESS .. PRESS ANY KEY ... : \n
"
)
;
getch
(
)
;
- printf
(
"A line is is %d x + %d y + %d =0 : \n
"
,
LINE1->
a,
LINE1->
b,
LINE1->
c)
;
- printf
(
"A line is is %d x + %d y + %d =0 : \n
"
,
LINE2->
a,
LINE2->
b,
LINE2->
c)
;
- printf
(
"CALCULATING INTERSECTION : \n
"
)
;
- detA=
LINE1->
a*
LINE2->
b -
LINE1->
b*
LINE2->
a;
- det1=
LINE1->
a*
LINE2->
k -
LINE2->
a*
LINE1->
k ;
- det2=
LINE2->
b*
LINE1->
k -
LINE1->
b*
LINE2->
k;
- x=
float
(
det2)
/
float
(
detA)
;
- y=
float
(
det1)
/
float
(
detA)
;
- printf
(
"INTERSECTION OF LINES %d & %d IS : X CORD = %f , Y CORD %f :\n
"
,
l1,
l2,
x,
y)
;
- printf
(
"END OF CODE : PRES ANY KEY ...... : "
)
;
- getch
(
)
;
- 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.
Download
You must upgrade your account or reply in the thread to view hidden text.