Thursday, March 10, 2016
Mid point Cliping Algorithm
//Created By "Arunendra Kumar"//
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
void mpsd(int,int,int,int);
int x_min,y_min,x_max,y_max;
int x1,y1,x2,y2,gd=DETECT,gm;
void main()
{
clrscr();
printf("\nEnter the value of Window co-ordinates:");
printf("(x_min,y_min) : " );
scanf("%d%d",&x_min,&y_min);
printf("(x_max,y_max) : " );
scanf("%d%d",&x_max,&y_max);
printf("\nEnter the co-ordinates of view point :");
printf("(x1,y1) :" );
scanf("%d%d",&x1,&y1);
printf("(x2,y2) :" );
scanf("%d%d",&x2,&y2);
clrscr();
initgraph(&gd,&gm,"c:\\tc\\bgi");
setcolor(RED);
rectangle(x_min,y_min,x_max,y_max);
mpsd(x1,y1,x2,y2);
getch();
}
void mpsd(int xa,int ya,int xb,int yb)
{
if( ((xa>=x_min)&&(xa<=x_max))&&((ya>=y_min)&&(ya<=y_max))&&((xb>=x_min)&&(xb<=x_max))&&((yb>=y_min)&&(yb<=y_max)) )
{
setcolor(YELLOW);
line(xa,ya,xb,yb);
}
else if( ((xa<=x_min)&&(xb<=x_min))||((ya<=y_min)&&(yb<=y_min))||((xa>=x_max)&&(xb>=x_max))||((ya>=y_max)&&(yb>=y_max)))
{
setcolor(GREEN);
line(xa,ya,xb,yb);
}
else
{
mpsd( xa,ya,((xa+xb)/2) ,((ya+yb)/2) );
mpsd( ((xa+xb)/2) ,((ya+yb)/2),xb,yb );
}
//getch();
}
//For download .CPP file click on MPSD.CPP
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
void mpsd(int,int,int,int);
int x_min,y_min,x_max,y_max;
int x1,y1,x2,y2,gd=DETECT,gm;
void main()
{
clrscr();
printf("\nEnter the value of Window co-ordinates:");
printf("(x_min,y_min) : " );
scanf("%d%d",&x_min,&y_min);
printf("(x_max,y_max) : " );
scanf("%d%d",&x_max,&y_max);
printf("\nEnter the co-ordinates of view point :");
printf("(x1,y1) :" );
scanf("%d%d",&x1,&y1);
printf("(x2,y2) :" );
scanf("%d%d",&x2,&y2);
clrscr();
initgraph(&gd,&gm,"c:\\tc\\bgi");
setcolor(RED);
rectangle(x_min,y_min,x_max,y_max);
mpsd(x1,y1,x2,y2);
getch();
}
void mpsd(int xa,int ya,int xb,int yb)
{
if( ((xa>=x_min)&&(xa<=x_max))&&((ya>=y_min)&&(ya<=y_max))&&((xb>=x_min)&&(xb<=x_max))&&((yb>=y_min)&&(yb<=y_max)) )
{
setcolor(YELLOW);
line(xa,ya,xb,yb);
}
else if( ((xa<=x_min)&&(xb<=x_min))||((ya<=y_min)&&(yb<=y_min))||((xa>=x_max)&&(xb>=x_max))||((ya>=y_max)&&(yb>=y_max)))
{
setcolor(GREEN);
line(xa,ya,xb,yb);
}
else
{
mpsd( xa,ya,((xa+xb)/2) ,((ya+yb)/2) );
mpsd( ((xa+xb)/2) ,((ya+yb)/2),xb,yb );
}
//getch();
}
//For download .CPP file click on MPSD.CPP
Wednesday, March 9, 2016
Add no. & Save in file
//Created By "Arunendra Kumar"//
#include<stdio.h>
#include<conio.h>
int add()
{
int x,y,a;
printf("Enter the value of x,y\n");
scanf("%d%d",&x,&y);
a=x+y;
printf("Sum=%d",a);
getch();
return a;
}
void main()
{
int n,x,y;
clrscr();
FILE *z;
z=fopen("c:\\Addition.txt","a");
if(z==NULL)
{
printf("Error");
getch();
}
n=add();
printf("%d",n);
fprintf(z,"\nno.s are %d ,%d",x,y);
fprintf(z," Sum = %d ",n);
fclose(z);
}
getch();
#include<stdio.h>
#include<conio.h>
int add()
{
int x,y,a;
printf("Enter the value of x,y\n");
scanf("%d%d",&x,&y);
a=x+y;
printf("Sum=%d",a);
getch();
return a;
}
void main()
{
int n,x,y;
clrscr();
FILE *z;
z=fopen("c:\\Addition.txt","a");
if(z==NULL)
{
printf("Error");
getch();
}
n=add();
printf("%d",n);
fprintf(z,"\nno.s are %d ,%d",x,y);
fprintf(z," Sum = %d ",n);
fclose(z);
}
getch();
First Come First Serve(Operating System)
//Created by "Arunendra Kumar"//
#include<stdio.h>
#include<conio.h>
void main()
{
int a[10],n,i,sum=0,total;
float avg;
clrscr();
printf("\nEnter the no of process : ");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
printf("Enter the burst time for the prcess %d is :",i);
scanf("%d",&a[i]);
}
printf("\nProcess\t\tBurst time\n");
for(i=1;i<=n;i++)
{
printf("%d\t\t%d\n",i,sum);
sum=sum+a[i];
}
sum=0;
total=0;
for(i=1;i<n;i++)
{
sum=sum+a[i];
total=total+sum;
}
avg=total/(float)n;
printf("\nTotal burst time taken by process : %d microseconds",total);
printf("\nAvarage time taken by processes : %f microseconds",avg);
getch();
}
#include<stdio.h>
#include<conio.h>
void main()
{
int a[10],n,i,sum=0,total;
float avg;
clrscr();
printf("\nEnter the no of process : ");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
printf("Enter the burst time for the prcess %d is :",i);
scanf("%d",&a[i]);
}
printf("\nProcess\t\tBurst time\n");
for(i=1;i<=n;i++)
{
printf("%d\t\t%d\n",i,sum);
sum=sum+a[i];
}
sum=0;
total=0;
for(i=1;i<n;i++)
{
sum=sum+a[i];
total=total+sum;
}
avg=total/(float)n;
printf("\nTotal burst time taken by process : %d microseconds",total);
printf("\nAvarage time taken by processes : %f microseconds",avg);
getch();
}
Shortest Job First(Operating System)
//Created by "Arunendra Kumar"//
#include<stdio.h>
#include<conio.h>
void main()
{
int a[100],i,j,t,n,smallest,temp,sum=0,total=0;
float avg;
clrscr();
printf("\n\t\t\tScheduling program of SJF\n\n");
printf("\nEnter the no of jobs : ");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("Enter the burst time for %d process : ",i+1);
scanf("%d",&a[i]);
}
for(i=0;i<n;i++)
{
smallest=i;
for(j=i+1;j<n;j++)
{
if(a[j]<a[smallest])
{
smallest=j;
}
}
temp=a[i];
a[i]=a[smallest];
a[smallest]=temp;
}
printf("\nProcesses are :\n\n");
printf("Process no \t\tBurst time\n");
for(i=0;i<n;i++)
{
printf("%d\t\t\t\t%d\n",i+1,sum);
sum=sum+a[i];
}
sum=0;
for(i=0;i<n-1;i++)
{
sum=sum+a[i];
total=total+sum;
}
avg=total/(float)n;
printf("\nTotal burst time is: %d microseconds",total);
printf("\nAvarage burst time is: %f microseconds",avg);
getch();
}
#include<stdio.h>
#include<conio.h>
void main()
{
int a[100],i,j,t,n,smallest,temp,sum=0,total=0;
float avg;
clrscr();
printf("\n\t\t\tScheduling program of SJF\n\n");
printf("\nEnter the no of jobs : ");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("Enter the burst time for %d process : ",i+1);
scanf("%d",&a[i]);
}
for(i=0;i<n;i++)
{
smallest=i;
for(j=i+1;j<n;j++)
{
if(a[j]<a[smallest])
{
smallest=j;
}
}
temp=a[i];
a[i]=a[smallest];
a[smallest]=temp;
}
printf("\nProcesses are :\n\n");
printf("Process no \t\tBurst time\n");
for(i=0;i<n;i++)
{
printf("%d\t\t\t\t%d\n",i+1,sum);
sum=sum+a[i];
}
sum=0;
for(i=0;i<n-1;i++)
{
sum=sum+a[i];
total=total+sum;
}
avg=total/(float)n;
printf("\nTotal burst time is: %d microseconds",total);
printf("\nAvarage burst time is: %f microseconds",avg);
getch();
}
Solid Circle with Sound
//This program is created by "Arunendra Kumar"//
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<dos.h>
#include<stdlib.h>
int gd=DETECT,gm,i,r1,xc,yc,r2,r3,x,y;
float e;
void main()
{
void circle();
printf("\nEnter the Centre of circle : ");
scanf("%d\t\t%d",&xc,&yc);
printf("\nEnter the radius of circles r1,r2");
scanf("%d\t\t%d",&r1,&r2);
clrscr();
initgraph(&gd,&gm,"c:\\tc\\bgi");
if(r1>r2)
{
for(i=0;i<r1;i++)
{
sound(10*random(100));
delay(100);
nosound();
circle();
}
}
else
{
for(i=0;i<r2;i++)
{
circle();
}
}
getch();
}
void circle()
{
x=0;
y=i;
e=3-(2*i);
while(x<y)
{
if(e<0)
{
x=x+1;
e=e+(4*x)+6;
}
else
{
x=x+1;
y=y-1;
e=e+(4*(x-y))+10;
}
putpixel(xc+x,yc+y,1);
putpixel(xc+y,yc+x,2);
putpixel(xc-x,yc+y,3);
putpixel(xc-y,yc+x,4);
putpixel(xc-x,yc-y,5);
putpixel(xc-y,yc-x,6);
putpixel(xc+x,yc-y,7);
putpixel(xc+y,yc-x,8);
}
}
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<dos.h>
#include<stdlib.h>
int gd=DETECT,gm,i,r1,xc,yc,r2,r3,x,y;
float e;
void main()
{
void circle();
printf("\nEnter the Centre of circle : ");
scanf("%d\t\t%d",&xc,&yc);
printf("\nEnter the radius of circles r1,r2");
scanf("%d\t\t%d",&r1,&r2);
clrscr();
initgraph(&gd,&gm,"c:\\tc\\bgi");
if(r1>r2)
{
for(i=0;i<r1;i++)
{
sound(10*random(100));
delay(100);
nosound();
circle();
}
}
else
{
for(i=0;i<r2;i++)
{
circle();
}
}
getch();
}
void circle()
{
x=0;
y=i;
e=3-(2*i);
while(x<y)
{
if(e<0)
{
x=x+1;
e=e+(4*x)+6;
}
else
{
x=x+1;
y=y-1;
e=e+(4*(x-y))+10;
}
putpixel(xc+x,yc+y,1);
putpixel(xc+y,yc+x,2);
putpixel(xc-x,yc+y,3);
putpixel(xc-y,yc+x,4);
putpixel(xc-x,yc-y,5);
putpixel(xc-y,yc-x,6);
putpixel(xc+x,yc-y,7);
putpixel(xc+y,yc-x,8);
}
}
Circle genrating Algorithm
//This Program is created by "Arunendra Kumar"//
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
void main()
{
int xc,yc,x,y,r,gdriver=DETECT,gmode;
float e;
clrscr();
initgraph(&gdriver,&gmode,"c:\\tc\\bgi");
printf("\nEnter the centre of Circle : ");
scanf("%d%d",&xc,&yc);
printf("\nEnter the radius of circle : ");
scanf("%d",&r);
x=0;
y=r;
e=1-r; /* Mid Point Algorithm */
//e=3-(2*r); /*Bresenham circle algorithm*/
while(x<y)
{
if(e<0)
{
x=x+1;
e=e+(2*x)+1;
//e=e+(4*x)+6;
}
else
{
x=x+1;
y=y-1;
e=e+(2*(x-y))+1;
//e=e+4(x-y)+10;
}
putpixel(xc+x,yc+y,RED);
putpixel(xc+y,yc+x,RED);
putpixel(xc-x,yc+y,RED);
putpixel(xc-y,yc+x,RED);
putpixel(xc-x,yc-y,RED);
putpixel(xc-y,yc-x,RED);
putpixel(xc+x,yc-y,RED);
putpixel(xc+y,yc-x,RED);
}
x=0;
y=r;
putpixel(xc+x,yc+y,RED);
putpixel(xc-x,yc+y,RED);
putpixel(xc-x,yc-y,RED);
putpixel(xc+x,yc-y,RED);
getch();
}
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
void main()
{
int xc,yc,x,y,r,gdriver=DETECT,gmode;
float e;
clrscr();
initgraph(&gdriver,&gmode,"c:\\tc\\bgi");
printf("\nEnter the centre of Circle : ");
scanf("%d%d",&xc,&yc);
printf("\nEnter the radius of circle : ");
scanf("%d",&r);
x=0;
y=r;
e=1-r; /* Mid Point Algorithm */
//e=3-(2*r); /*Bresenham circle algorithm*/
while(x<y)
{
if(e<0)
{
x=x+1;
e=e+(2*x)+1;
//e=e+(4*x)+6;
}
else
{
x=x+1;
y=y-1;
e=e+(2*(x-y))+1;
//e=e+4(x-y)+10;
}
putpixel(xc+x,yc+y,RED);
putpixel(xc+y,yc+x,RED);
putpixel(xc-x,yc+y,RED);
putpixel(xc-y,yc+x,RED);
putpixel(xc-x,yc-y,RED);
putpixel(xc-y,yc-x,RED);
putpixel(xc+x,yc-y,RED);
putpixel(xc+y,yc-x,RED);
}
x=0;
y=r;
putpixel(xc+x,yc+y,RED);
putpixel(xc-x,yc+y,RED);
putpixel(xc-x,yc-y,RED);
putpixel(xc+x,yc-y,RED);
getch();
}
Polygon's Program
// This Program is created by "Arunendra Kumar"//
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<stdlib.h>
#include<math.h>
#include<dos.h>
void main()
{
again:
int gd=DETECT,gm,n;
double a[10][10],b[10][10],c[10][10];
int i,j,k,m,x1[10],y1[10],x[10],y[10],sx,sy;
char ch;
initgraph(&gd,&gm,"c:\\tc\\bgi");
printf("\nEnter the no of sides : ");
scanf("%d",&n);
if(n<3)
{
printf("\nPolygon can not form\n");
goto exit;
getch();
}
else
{
for(i=1;i<=n;i++)
{
printf("\nEnter the co-ordinates (x%d,y%d) : ",i,i);
scanf("%d%d",&x[i],&y[i]);
}
cleardevice();
for(i=1;i<n;i++)
{
setcolor(RED);
line(320+x[i],240-y[i],320+x[i+1],240-y[i+1]);
}
setcolor(RED);
line(320+x[1],240-y[1],320+x[n],240-y[n]);
}
getch();
//again:
printf("\nWhat you want to do : \n");
printf("\n1.Scaling");
printf("\n2.Translating");
printf("\n3.Reflection");
printf("\n4.Rotation");
printf("\n5.Shearing");
printf("\n6.Exit");
printf("\nPlease enter your choice : ");
scanf("%d",&m);
switch(m)
{
case 1:
{
printf("\nEnter the scaling points : ");
scanf("%d%d",&sx,&sy);
a[1][1]=sx;
a[1][2]=0;
a[1][3]=0;
a[2][1]=0;
a[2][2]=sy;
a[2][3]=0;
a[3][1]=0;
a[3][2]=0;
a[3][3]=1;
break;
}
case 2:
{
int tx,ty;
printf("\nEnter the translation points : ");
scanf("%d%d",&tx,&ty);
a[1][1]=1;
a[1][2]=0;
a[1][3]=tx;
a[2][1]=0;
a[2][2]=1;
a[2][3]=ty;
a[3][1]=0;
a[3][2]=0;
a[3][3]=1;
break;
}
case 3:
{
int r;
printf("\nWhich direction");
printf("\n1.Reflection in x direction ");
printf("\n2.Reflection in y direction ");
printf("\n3.Reflection about origin");
printf("\nEnter choice : ");
scanf("%d",&r);
switch(r)
{
case 1:
{
a[1][1]=1;
a[1][2]=0;
a[1][3]=0;
a[2][1]=0;
a[2][2]=-1;
a[2][3]=0;
a[3][1]=0;
a[3][2]=0;
a[3][3]=1;
break;
}
case 2:
{
a[1][1]=-1;
a[1][2]=0;
a[1][3]=0;
a[2][1]=0;
a[2][2]=1;
a[2][3]=0;
a[3][1]=0;
a[3][2]=0;
a[3][3]=1;
break;
}
case 3:
{
a[1][1]=-1;
a[1][2]=0;
a[1][3]=0;
a[2][1]=0;
a[2][2]=-1;
a[2][3]=0;
a[3][1]=0;
a[3][2]=0;
a[3][3]=1;
break;
}
}
break;
}
case 4:
{
int q;
double s,o;
printf("\nEnter the angle : ");
scanf("%lf",&o);
s=(o*(3.14/180));
printf("\nWhich direction :");
printf("\n1.Clockwise direction ");
printf("\n2.Anticlockwise direction ");
printf("\nEnter choice : ");
scanf("%d",&q);
switch(q)
{
case 1:
{
a[1][1]=cos(s);
a[1][2]=sin(s);
a[1][3]=0;
a[2][1]=-sin(s);
a[2][2]=cos(s);
a[2][3]=0;
a[3][1]=0;
a[3][2]=0;
a[3][3]=1;
break;
}
case 2:
{
a[1][1]=cos(s);
a[1][2]=-sin(s);
a[1][3]=0;
a[2][1]=sin(s);
a[2][2]=cos(s);
a[2][3]=0;
a[3][1]=0;
a[3][2]=0;
a[3][3]=1;
break;
}
}
break;
}
case 5:
{
int shx,shy;
printf("\nEnter the shearing points : ");
scanf("%d%d",&shx,­);
a[1][1]=1;
a[1][2]=shx;
a[1][3]=0;
a[2][1]=shy;
a[2][2]=1;
a[2][3]=0;
a[3][1]=0;
a[3][2]=0;
a[3][3]=1;
break;
}
exit: case 6:
{
while(!kbhit())
{
++i;
cleardevice();
setcolor(i);
settextstyle(7,0,8);
outtextxy(i,100,"Good Bye");
delay(8);
}
getch();
exit (0);
}
default :
{
printf("\nYou are entered Wrong Keyword");
break;
}
}
for(i=1;i<=n;i++)
{
b[1][i]=x[i];
b[2][i]=y[i];
b[3][i]=1;
}
for(i=1;i<=3;i++)
{
for(j=1;j<=n;j++)
{
c[i][j]=0;
for(k=1;k<=3;k++)
{
c[i][j]=c[i][j]+a[i][k]*b[k][j];
}
}
}
for(i=1;i<=n;i++)
{
x1[i]=c[1][i];
y1[i]=c[2][i];
}
for(i=1;i<n;i++)
{
setcolor(GREEN);
line(320+x1[i],240-y1[i],320+x1[i+1],240-y1[i+1]);
}
setcolor(GREEN);
line(320+x1[1],240-y1[1],320+x1[n],240-y1[n]);
getch();
printf("\nAre you want make new graph :y/n ");
fflush(stdin);
scanf("%c",&ch);
if(ch=='Y'||ch=='y')
{
cleardevice();
goto again;
}
else
{ cleardevice();
goto exit;
}
getch();
}
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<stdlib.h>
#include<math.h>
#include<dos.h>
void main()
{
again:
int gd=DETECT,gm,n;
double a[10][10],b[10][10],c[10][10];
int i,j,k,m,x1[10],y1[10],x[10],y[10],sx,sy;
char ch;
initgraph(&gd,&gm,"c:\\tc\\bgi");
printf("\nEnter the no of sides : ");
scanf("%d",&n);
if(n<3)
{
printf("\nPolygon can not form\n");
goto exit;
getch();
}
else
{
for(i=1;i<=n;i++)
{
printf("\nEnter the co-ordinates (x%d,y%d) : ",i,i);
scanf("%d%d",&x[i],&y[i]);
}
cleardevice();
for(i=1;i<n;i++)
{
setcolor(RED);
line(320+x[i],240-y[i],320+x[i+1],240-y[i+1]);
}
setcolor(RED);
line(320+x[1],240-y[1],320+x[n],240-y[n]);
}
getch();
//again:
printf("\nWhat you want to do : \n");
printf("\n1.Scaling");
printf("\n2.Translating");
printf("\n3.Reflection");
printf("\n4.Rotation");
printf("\n5.Shearing");
printf("\n6.Exit");
printf("\nPlease enter your choice : ");
scanf("%d",&m);
switch(m)
{
case 1:
{
printf("\nEnter the scaling points : ");
scanf("%d%d",&sx,&sy);
a[1][1]=sx;
a[1][2]=0;
a[1][3]=0;
a[2][1]=0;
a[2][2]=sy;
a[2][3]=0;
a[3][1]=0;
a[3][2]=0;
a[3][3]=1;
break;
}
case 2:
{
int tx,ty;
printf("\nEnter the translation points : ");
scanf("%d%d",&tx,&ty);
a[1][1]=1;
a[1][2]=0;
a[1][3]=tx;
a[2][1]=0;
a[2][2]=1;
a[2][3]=ty;
a[3][1]=0;
a[3][2]=0;
a[3][3]=1;
break;
}
case 3:
{
int r;
printf("\nWhich direction");
printf("\n1.Reflection in x direction ");
printf("\n2.Reflection in y direction ");
printf("\n3.Reflection about origin");
printf("\nEnter choice : ");
scanf("%d",&r);
switch(r)
{
case 1:
{
a[1][1]=1;
a[1][2]=0;
a[1][3]=0;
a[2][1]=0;
a[2][2]=-1;
a[2][3]=0;
a[3][1]=0;
a[3][2]=0;
a[3][3]=1;
break;
}
case 2:
{
a[1][1]=-1;
a[1][2]=0;
a[1][3]=0;
a[2][1]=0;
a[2][2]=1;
a[2][3]=0;
a[3][1]=0;
a[3][2]=0;
a[3][3]=1;
break;
}
case 3:
{
a[1][1]=-1;
a[1][2]=0;
a[1][3]=0;
a[2][1]=0;
a[2][2]=-1;
a[2][3]=0;
a[3][1]=0;
a[3][2]=0;
a[3][3]=1;
break;
}
}
break;
}
case 4:
{
int q;
double s,o;
printf("\nEnter the angle : ");
scanf("%lf",&o);
s=(o*(3.14/180));
printf("\nWhich direction :");
printf("\n1.Clockwise direction ");
printf("\n2.Anticlockwise direction ");
printf("\nEnter choice : ");
scanf("%d",&q);
switch(q)
{
case 1:
{
a[1][1]=cos(s);
a[1][2]=sin(s);
a[1][3]=0;
a[2][1]=-sin(s);
a[2][2]=cos(s);
a[2][3]=0;
a[3][1]=0;
a[3][2]=0;
a[3][3]=1;
break;
}
case 2:
{
a[1][1]=cos(s);
a[1][2]=-sin(s);
a[1][3]=0;
a[2][1]=sin(s);
a[2][2]=cos(s);
a[2][3]=0;
a[3][1]=0;
a[3][2]=0;
a[3][3]=1;
break;
}
}
break;
}
case 5:
{
int shx,shy;
printf("\nEnter the shearing points : ");
scanf("%d%d",&shx,­);
a[1][1]=1;
a[1][2]=shx;
a[1][3]=0;
a[2][1]=shy;
a[2][2]=1;
a[2][3]=0;
a[3][1]=0;
a[3][2]=0;
a[3][3]=1;
break;
}
exit: case 6:
{
while(!kbhit())
{
++i;
cleardevice();
setcolor(i);
settextstyle(7,0,8);
outtextxy(i,100,"Good Bye");
delay(8);
}
getch();
exit (0);
}
default :
{
printf("\nYou are entered Wrong Keyword");
break;
}
}
for(i=1;i<=n;i++)
{
b[1][i]=x[i];
b[2][i]=y[i];
b[3][i]=1;
}
for(i=1;i<=3;i++)
{
for(j=1;j<=n;j++)
{
c[i][j]=0;
for(k=1;k<=3;k++)
{
c[i][j]=c[i][j]+a[i][k]*b[k][j];
}
}
}
for(i=1;i<=n;i++)
{
x1[i]=c[1][i];
y1[i]=c[2][i];
}
for(i=1;i<n;i++)
{
setcolor(GREEN);
line(320+x1[i],240-y1[i],320+x1[i+1],240-y1[i+1]);
}
setcolor(GREEN);
line(320+x1[1],240-y1[1],320+x1[n],240-y1[n]);
getch();
printf("\nAre you want make new graph :y/n ");
fflush(stdin);
scanf("%c",&ch);
if(ch=='Y'||ch=='y')
{
cleardevice();
goto again;
}
else
{ cleardevice();
goto exit;
}
getch();
}
Subscribe to:
Posts (Atom)