RESIST_DRAW.c



/* DIBUJO DE UNA RESISTENCIA
*/


#include<graphics.h>

// DEFINICION DE LOS COLORES
#define NEGRO 0
#define ROJO  4

void Resistencia(int x, int y)
{
	int Rad = 20;

	setcolor(YELLOW);
	line(x, y, x+100, y);
	line(x, y+Rad*2, x+100, y+Rad*2);
	line(x-50, y+Rad, x-20, y+Rad);
	line(x+120, y+Rad, x+150, y+Rad);

	// colores significativos
	line(x+10, y, x+10, y+40);  line(x+20, y, x+20, y+40);
	line(x+30, y, x+30, y+40);  line(x+40, y, x+40, y+40);
	// color tolerancia
	line(x+60, y, x+60, y+40);  line(x+70, y, x+70, y+40);
	arc(x, y+Rad, 90, 270, 20); arc(x+100, y+Rad, 270, 90, 20);
	// barras de colores
	setcolor(BROWN); bar(x+10, y, x+20, 140);
	setcolor(GREEN); bar(x+20, y, x+30, 140);
	setcolor(BLUE); bar(x+30, y, x+40, 140);
	setcolor(WHITE); bar(x+60, y, x+70, 140);
}

int main()
{
	int gd = DETECT,gm;
	initgraph(&gd,&gm,NULL);

	Resistencia(100, 100);
   delay(60000);
   closegraph();
   return 0;
}