Esempio n. 1
0
void speedfan(int d)
{
    int i=0;
    while(1)
    {
      if(i==360) break;
      setfillstyle(1,15);
      pieslice(midx,midy,0+i,30+i,150);
      floodfill(midx,midy,15);

      setfillstyle(1,15);
      pieslice(midx,midy,120+i,150+i,150);
      floodfill(midx,midy,15);

      setfillstyle(1,15);
      pieslice(midx,midy,240+i,270+i,150);
      floodfill(midx,midy,15);



      delay(d);
      cleardevice();
      i=i+30;
    }


}
Esempio n. 2
0
File: pie.c Progetto: kiran00/csit-c
int main()
{
   int gd = DETECT, gm, midx, midy;
 
   initgraph(&gd, &gm, "C:\\TC\\BGI");
 
   setcolor(MAGENTA);
   rectangle(0,40,639,450);
   settextstyle(SANS_SERIF_FONT,HORIZ_DIR,2);
   setcolor(WHITE);
   outtextxy(275,10,"Pie Chart");
 
   midx = getmaxx()/2;
   midy = getmaxy()/2;
 
   setfillstyle(LINE_FILL,BLUE);
   pieslice(midx, midy, 0, 75, 100);
   outtextxy(midx+100, midy - 75, "20.83%");
 
   setfillstyle(XHATCH_FILL,RED);
   pieslice(midx, midy, 75, 225, 100);
   outtextxy(midx-175, midy - 75, "41.67%");
 
   setfillstyle(WIDE_DOT_FILL,GREEN);
   pieslice(midx, midy, 225, 360, 100);
   outtextxy(midx+75, midy + 75, "37.50%");
 
   getch();
   return 0;
}
Esempio n. 3
0
void draw()
{if(s==0){if(b==1)putpixel(x,y,c);
if(b==2)putpixel(x,y,0);}
else if(s==1){if(b==2)pieslice(x,y,0,360,5);
if(b==1)pieslice(x,y,0,360,2);}
else if(s==2){if(b==1)rectangle(x,y,x+10,y+10);
if(b==2)bar(x,y,x+10,y+10);}
}
Esempio n. 4
0
int time_control(){
	if (prev != new_time.ti_sec)//show hour minute and second when prev!=ti.te_sec
	{                               //that is after 1 second
		setfillstyle(1,4);
		setcolor(4);
		pieslice(550,260,angle,angle+1,30);
		angle-= INCREASE;
		if(increase==90)
			angle=359;
		if(increase==180)
			angle=269;
		if(increase==270)
			angle=179;
		sec++;
		increase+= INCREASE;
		if(sec==60){
			min++;	sec=0;
		}
		setfillstyle(1,15);
		bar(569,47,589,60);
		if(second<=9){
			if(!second){
				bar(550,47,560,60);
				if(!minute){
					color_text(574,50,"00",4);
					outtextxy(550,50,"0");
					setfillstyle(1,4);
					setcolor(4);
					pieslice(550,260,90,120,30);
					summary_content();
					end_lesson(min,sec,eff,err,speed);
					return 1;

				}
				minute--;
				second=59;
				show_number(second,574,50,4,0,1);
			}
			else{
				outtextxy(574,50,"0");
				show_number(second,582,50,4,0,1);
			}
		}

		else
			show_number(second,574,50,4,0,1);
		show_number(minute,552,50,4,0,1);
		second--;
		prev = new_time.ti_sec;

	}

	return 0;

}
Esempio n. 5
0
void PlaceQueen(int row, int column)
{
	if (column == 0)/*Queen was in HOme*/
	{
		setfillstyle(SOLID_FILL, LIGHTBLUE) ;
		setcolor(LIGHTBLUE);
		pieslice(SQSIZE / 2, row * SQSIZE + SQSIZE / 2, 0, 360, 4);
	}
	delay(100);sound(400);delay(DELAY);nosound();
	setfillstyle(SOLID_FILL, BLUE) ;
	setcolor(BLUE);
	pieslice((column + 1) * SQSIZE + SQSIZE / 2, row * SQSIZE + SQSIZE / 2, 0,360, 4);
}
Esempio n. 6
0
void drawfan()
{
   setfillstyle(1,15);
   pieslice(midx,midy,0,30,150);
   floodfill(midx,midy,15);

   setfillstyle(1,15);
   pieslice(midx,midy,120,150,150);
   floodfill(midx,midy,15);

   setfillstyle(1,15);
   pieslice(midx,midy,240,270,150);
   floodfill(midx,midy,15);

}
Esempio n. 7
0
void cardio(int col,int lin,int r)
{
   int p[6];
   fillellipse(col-r,lin,r,r);
   fillellipse(col+r,lin,r,r);
   pieslice(col,lin,180,210,2*r);
   pieslice(col,lin,330,360,2*r);
   p[0]=col-(1.75*r);p[1]=0.98*r+lin;
   p[2]=col;p[3]=3.3*r+lin;
   p[4]=col+(1.75*r);p[5]=0.98*r+lin;
   fillpoly(3, p);
   p[2]=col;
   p[3]=lin;
   fillpoly(3, p);
}
Esempio n. 8
0
void main()										//Main function
{

	int gd=DETECT,gm=VGAMAX;
	float i,j,xr,xy,x,y;
	initgraph(&gd,&gm,0);
	int a[]={50,100,100,100,100,150,150,150,150,200,200,200,200,250,250,250,250,300,300,300,300,350,50,350,50,100};
	
	fillpoly(13,a);								//Draw polygon
	
	setcolor(RED);
	pieslice(75,75,0,360,25);
	xr=75;xy=75;
	delay(100);
	
	for(j=0;j<5;j++)
	{
	x=xr+25;y=xy;
	for(i=180;i<=360;i++)
	{	
		cleardevice();
		setcolor(WHITE);
		fillpoly(13,a);
		setcolor(RED);
		pieslice(x+25*cos(i*3.14/180),y+25*sin(i*3.14/180),0,360,25);
		delay(10);
		xr=x+25*cos(i*3.14/180);
		xy=y+25*sin(i*3.14/180);
	}
	for(i=0;i<50;i++)
	{	
		xy++;
		cleardevice();
		setcolor(WHITE);
		fillpoly(13,a);
		setcolor(RED);
		pieslice(xr,xy,0,360,25);
		delay(10);
	}
	}
	getch();
	closegraph();								//close graph
}
Esempio n. 9
0
void RemoveQueen(int row, int column)
{
	delay(500);
	sound(200);
	delay(DELAY+300);
	nosound();
	if (row % 2 != column % 2)
	{
		setcolor(WHITE); setfillstyle(SOLID_FILL, WHITE);
	}
	else
	{
		setcolor(YELLOW); setfillstyle(SOLID_FILL, YELLOW);
	}
	pieslice((column + 1) * SQSIZE + SQSIZE / 2, row * SQSIZE + SQSIZE / 2, 0,360, 4);
}
Esempio n. 10
0
int main()
{
	struct pie_data data[MAX];
	int gd = DETECT, gm;
	int i, j, k, n, total_freq = 0, start_angle = 0, end_angle = 0, xmax, ystart = 80, yend;
	printf("Enter the number of items: ");
	scanf("%d", &n);
	
	for (i = 0, j = 1, k = 1; i < n; i++)
	{
		printf("Enter the item title: ");
		scanf("%s", data[i].desc);
		printf("Enter the item frequency: ");
		scanf("%d", &data[i].freq);
		total_freq += data[i].freq;
		data[i].color = j;
		data[i].style = k;
		if (j++ >= 13) j = 1;
		if (k++ >= 11) k = 1;
	}
	
	for (i = 0; i < n; i++)
	{
		float angle;
		data[i].angle = 360 * (data[i].freq /(float) total_freq);
	}
	
	initgraph(&gd, &gm, "C:\\TurboC3\\BGI");
	xmax = getmaxx() - 150;
	setaspectratio(10000, 10000);
	for (i = 0; i < n; i++)
	{
		end_angle = start_angle + data[i].angle;
		setcolor(data[i].color);
		setfillstyle(data[i].style, data[i].color);
		pieslice(X_CENTRE, Y_CENTRE, (int)start_angle, (int)end_angle, RADIUS);
		start_angle = end_angle;
		yend = ystart + 40;
		bar(xmax, ystart, xmax + 70, yend);
		ystart = yend + 15;
		outtextxy(xmax + 80, ystart - 20, data[i].desc);
	}
	getch();
	closegraph();
	return 0;
}
Esempio n. 11
0
void eraser()
{
 bar(15);

 setfillstyle(SOLID_FILL,15);
 int button,x,y;

  mousepos(button,x,y);
  if(button==1 && x>48&&x<592&&y<452&&y>68)
  {
   static int v1=0,v2=0;
   hidemouse();
   pieslice(x, y, 0, 360, 6);
   if(v1!=x ||v2!=y)
   {
    fout<<"pieslice("<<x<<','<<y<<','<<"0,360,6);\n";
    v1=x,v2=y;
   }
   mousecall();
  }

}
Esempio n. 12
0
void HomeQueen(int row)
{
	setfillstyle(SOLID_FILL, BLUE) ;
	setcolor(BLUE);
	pieslice(SQSIZE / 2, row * SQSIZE + SQSIZE / 2, 0, 360, 4);
}
Esempio n. 13
0
void login()
{
	struct login log;
	int gd,gm,x=60,y=8,p=155,q=35;
	int i,a=190,bo=50,d=90,c=75;
	int left, top, right, bottom;
       //	int points[]={620,150,620,400,20,400,320,150};
	int l,t,r,b;
       /*	int counter=0,flag=0;
	char uid[25],pwd[25],s_uid[][25]={"9913103538"};
       char s_pwd[][25]={"qwerty"},ch='a',bb[5],inst[5];
       //	int pa;
       //	char arr[20]={"abc"};
	int j=0;                                        */
	int j,counter=0,flag=0;
	char uid[25],pwd[25],abc[10],s_uid[][25]={"9913103563"},inst[5];
	char s_pwd[][25]={"qwerty"},ch='a',bb[5];

	char ch4;
	gd=DETECT;
	initgraph(&gd,&gm,"c:\\turboc3\\bgi");
	{
	delay(500);

	setcolor(YELLOW);
	settextstyle(1,HORIZ_DIR,4);
       outtextxy(a,bo,"JAYPEE INSTITUTE");
      settextstyle(1,HORIZ_DIR,4);
      outtextxy(c,d," OF INFORMATION TECHNOLOGY");
      settextstyle(8,0,3);
      outtextxy(200,130,"SECTOR-128,NOIDA");
      setcolor(CYAN);
       settextstyle(1,0,4);
      outtextxy(232,170,"INFO-KIOSK");


	for(i=0;i<=360;i++)
	{
		circle(300,330,8);
		if(i<=90)
		continue;
		else if(i>90&&i<=180)
		{
		setcolor(CYAN);

		}
		else if(i>180&&i<=270)
		{
		setcolor(YELLOW);

		}
		else
		{
		setcolor(RED);
		}
		pieslice(300,330,0,i,80);
		settextstyle(3,0,2);
		outtextxy(215,410,"Loading....please Wait");
		delay(10);
	}
	closegraph();
	}
	initgraph(&gd,&gm,"c:\\turboc3\\bgi" );
	left = getmaxy() / 1 - 500 ;
top = getmaxy() / 2 - 1000;
right = getmaxx() / 2 + 500;
bottom = getmaxy() / 2-180;
setfillstyle(1,6);
rectangle(top,left,right,bottom);
floodfill(getmaxx()/3,getmaxy()/100,15);
       settextstyle(3,0,3);
       outtextxy(x,y,"JAYPEE INSTITUTE OF INFORMATION TECHNOLOGY");
       settextstyle(3,0,1);
       outtextxy(p,q,"Deemed to be University under section 3 of UCG Act");
     //	int gd=DETECT,gm,
	delay(500);
	     //	initgraph(&gd,&gm,"C:\\turboc3\\bgi");
l = getmaxy() / 1 - 350 ;
t = getmaxy() / 2 - 240;
r = getmaxx() / 2 + 340;
b = getmaxy() / 1-60;
setfillstyle(1,6);
rectangle(t,l,r,b);
floodfill(getmaxx()/2,getmaxy()/2,15);
setcolor(BLACK);
settextstyle(1,0,9);
outtextxy(15,140,"LOGIN");
settextstyle(1,0,9);
outtextxy(22,240,"PAGE");


//fseek(fl,0,SEEK_END);
gotoxy(45,13);
printf("Institue:");
fflush(stdin);
gets(inst);
gotoxy(45,15);
printf("User-Id:");
fflush(stdin);
gets(uid);
gotoxy(45,17);
printf("Batch:");
fflush(stdin);
gets(bb);
gotoxy(45,19);
printf("Password:"******"\b");  /*printing backspace to move cursor 1 pos back*/
			printf("%c",32);/*making the char invisible which is already on console*/
			printf("\b"); /*printing backspace to move cursor 1 pos back*/
			i--;
			pwd[j]='\0';
		}
		else
		continue;
	}
	else
	{
	putchar('*');/* char - '*' will be printed instead of the character */
	pwd[j]=ch;
	j++;
	}
}
pwd[j]='\0';
for(j=0;j<=2;j++)
{
	if((strcmp(pwd,s_pwd[j])==0) && (stricmp(uid,s_uid[j]))==0)
	{
		flag=1;
		break;
	}
}
if(flag)
{gotoxy(45,21);
printf(" USER AUTHENTICATED ");
}
else
{
gotoxy(45,21);
printf("DENIED");
getch();
exit(0);
}
	getch();
	closegraph();
}
Esempio n. 14
0
  int main() {
	int gdriver = DETECT, gmode, err;
	int i = 0, midx, midy;
	int xrad[9], yrad[9], x[9][60], y[9][60];
	int pos[9], planet[9], tmp;
	initgraph(&gdriver, &gmode, "../bgi");
	err = graphresult();
	if (err != grOk)
	{
		printf("Graphics Error: %s",
		grapherrormsg(err));
		return 0;
	}
	midx = getmaxx() / 2;
	midy = getmaxy() / 2;
	planet[0] = 7;
	planet[1] = planet[0] + 1;
	pos[0] = 0 * 6;
	xrad[0] = 60, yrad[0] = 30;
		xrad[1] = xrad[0] + 30;
		yrad[1] = yrad[0] + 15;

	planetMotion(xrad[0], yrad[0], midx, midy, x[0], y[0]);
	while (!kbhit())
	{
		setcolor(WHITE);
		ellipse(midx, midy, 0, 360, xrad[0], yrad[0]);
		/* sun at the mid of the solar system */
		setcolor(RED);
		setfillstyle(SOLID_FILL, RED);
		circle(midx, midy, 20);
		floodfill(midx, midy, RED);
		setcolor(YELLOW);
		outtextxy(midx, midy,"SUN");

		setcolor(GREEN);
		setfillstyle(SOLID_FILL, GREEN);
		pieslice(x[0][pos[0]], y[0][pos[0]], 0, 360, planet[0]);
		setcolor(RED);
		outtextxy(x[0][pos[0]], y[0][pos[0]],"Earth");

		setcolor(WHITE);
		ellipse(x[0][pos[0]], y[0][pos[0]], 0, 360, planet[0]*3,planet[0]*3 );
		planetMotion(planet[0]*3,planet[0]*3 ,x[0][pos[0]], y[0][pos[0]], x[1], y[1]);
		setcolor(BLUE);
		setfillstyle(SOLID_FILL, BLUE);
		pieslice(x[1][pos[1]], y[1][pos[1]], 0, 360, planet[1]);
		setcolor(GREEN);
		outtextxy(x[1][pos[1]], y[1][pos[1]],"Moon");
		/* checking for one complete rotation */
		for (i = 0; i < 2; i++)
		 {
			if (pos[i] <= 0)
			{
				pos[i] = 59;
			}
			else
			{
				pos[i] = pos[i] - 1;
			}
		}
	       delay(100);

		cleardevice();
	}
	closegraph();
	return 0;
  }
Esempio n. 15
0
	 void Dibuja()
	 {
	 pieslice(xi,yi,sa,ea,r);
	 ver=1;
	 }
Esempio n. 16
0
main()
{
 int gdriver=DETECT,gmode;
 int i,j,k,l,x,x1,x2,y1,y2,x3,y3,x4,y4,x5,y5,x6,y6,x7,y7,x8,y8;
 initgraph(&gdriver,&gmode,"C:\\TC\\BGI");
  x1=115; y1=150; x2=145; y2=110;
  x3=155; y3=150; x4=185; y4=110;
  x5=195; y5=150; x6=225;  y6=110;
  x7=235; y7=150; x8=265;  y8=110;

  j=1;
  i=1;

  while(!(kbhit()))
 {
 i=0;
 //conveyor belt
 circle(90,200,50);
 circle(300,200,50);
 line(80,150,300,150);
 line(80,250,300,250);
 //bins
  rectangle(x1,y1,x2,y2);
  rectangle(x3,y3,x4,y4);
  rectangle(x5,y5,x6,y6);
  rectangle(x7,y7,x8,y8);

  if(x7>=320){
  i=0;
  if(x8<=560 && y7<=300){

  rectangle(x7+i,y7++,x8+i,y8++);
  i=i+8;
  }}
  if(x5>=320){
  i=0;

  if(x6<=560 && y5<=300){
  rectangle(x5+i,y5++,x6+i,y6++);
  i=i+10;
  }}
  if(x3>=320){
  i=0;

   if(x4<=560 && y3<=300){
  rectangle(x3+i,y3++,x4+i,y4++);
  i=i+10;
  }}
   if(x1>=320){
  i=0;
   if(x2<=560 && y1<=300){
  rectangle(x1+i,y1++,x2+i,y2++);
  i=i+10;
  }}
//basket
 rectangle(350,300,560,250);

 setfillstyle(EMPTY_FILL, getmaxcolor());
 pieslice(90,200,45-x,135-x,50);
 pieslice(90,200,135-x,225-x,50);
 pieslice(90,200,225-x,315-x,50);
 pieslice(90,200,90-x,270-x,50);
 pieslice(90,200,0-x,180-x,50);
 pieslice(300,200,45-x,135-x,50);
 pieslice(300,200,135-x,225-x,50);
 pieslice(300,200,225-x,315-x,50);
 pieslice(300,200,90-x,270-x,50);
 pieslice(300,200,0-x,180-x,50);
 if(x1<=370 || x3<=370 || x5<=370 ||x7<=370){
 x++;
 x1++,x2++;x3++;x4++;x5++;x6++;x7++; x8++; }
 delay(80);
 cleardevice();

 }
 cleardevice();
 getch();
 closegraph();
 return 0;

}