#include <graphics.h>
#include <iostream>
#include<math.h>
int xk,yk,r,xt,yt;
int rx,ry;
float rt;
main ( )
{
printf("Program za crtanje kruznice i tacke u krugu \n\n");
printf("Unesite kordinate i poluprecnik kruga\n");
printf("xk=");scanf("%d",&xk);
printf("yk=");scanf("%d",&yk);
printf("r=");scanf("%d",&r);
if((r<=xk)&&(r<=yk)&&(xk<=800)&&(xk>=0)&&(yk<=600)&&(yk>=0)&&(r+xk<=800)&&(r+yk<=600)){
printf("Unesite kordinate tacke\n");
printf("xt=");scanf("%d",&xt);
printf("yt=");scanf("%d",&yt);
rx=xt-xk;
ry=yt-yk;
rt=sqrt(pow(rx,2)+pow(ry,2));
if (rt<r){
printf("Tacka je u krugu \n");
}
else if(rt==r){
printf("Tacka je na kruznici\n");
}
else printf("Tacka je izvan kruga\n");
initwindow (800,600); /*otvara prozor velièine 800 x 600 piksela*/
circle (xk,yk,r);
//crtanje tacke
circle(xt,yt,2);
while (!kbhit( )); /*zadržava prozor sa crtežom otvorenim*/
closegraph( );
}
else{
printf("Krug nemoze da se nacrta prelazi okvire definisanog prostora 800x600");
getch();
}
//circle (400,300,200); /*crta krug èije su koordinate centra (400,300) polupreènika 200*/
}
#include <iostream>
#include<math.h>
int xk,yk,r,xt,yt;
int rx,ry;
float rt;
main ( )
{
printf("Program za crtanje kruznice i tacke u krugu \n\n");
printf("Unesite kordinate i poluprecnik kruga\n");
printf("xk=");scanf("%d",&xk);
printf("yk=");scanf("%d",&yk);
printf("r=");scanf("%d",&r);
if((r<=xk)&&(r<=yk)&&(xk<=800)&&(xk>=0)&&(yk<=600)&&(yk>=0)&&(r+xk<=800)&&(r+yk<=600)){
printf("Unesite kordinate tacke\n");
printf("xt=");scanf("%d",&xt);
printf("yt=");scanf("%d",&yt);
rx=xt-xk;
ry=yt-yk;
rt=sqrt(pow(rx,2)+pow(ry,2));
if (rt<r){
printf("Tacka je u krugu \n");
}
else if(rt==r){
printf("Tacka je na kruznici\n");
}
else printf("Tacka je izvan kruga\n");
initwindow (800,600); /*otvara prozor velièine 800 x 600 piksela*/
circle (xk,yk,r);
//crtanje tacke
circle(xt,yt,2);
while (!kbhit( )); /*zadržava prozor sa crtežom otvorenim*/
closegraph( );
}
else{
printf("Krug nemoze da se nacrta prelazi okvire definisanog prostora 800x600");
getch();
}
//circle (400,300,200); /*crta krug èije su koordinate centra (400,300) polupreènika 200*/
}
No comments:
Post a Comment