//GRAFICA DE BARRAS

#include<stdio.h>
#include<conio.h>
#include<dos.h>
int o=3;
int w=1;
void barra(int x,int y, int z)
{
if(z<21)
{
while(y>=25-z)
{
textcolor(w);
gotoxy(x,y);cprintf("");
y--;
delay(100);
}
w++;
gotoxy(x+2,y);cprintf("%d",z);
}
if(z>20)
{
textcolor(WHITE+BLINK);
gotoxy(62,o);cprintf("ERROR no valido %d",z);
o++;
}
}

void regla(int x,int y,int x1,int y1)
{
while(y<=y1)
{
gotoxy(x,y);cprintf("");
y++;
}
gotoxy(8,25);cprintf("");
while(x<=x1)
{
gotoxy(x,y1);cprintf("");
x++;
}
int a1=20;
int b1=5;
while(a1>=0)
{
textcolor(YELLOW);
if(a1>=10){gotoxy(5,b1);cprintf("%d-",a1);}
if(a1<10){gotoxy(6,b1);cprintf("%d-",a1);}
a1--;
b1++;
}
}
void main()
{
int a,b,c,d,e,f;
clrscr();
gotoxy(1,2);cprintf("Dame 6 numeros 0-20: ");
gotoxy(22,2);scanf("%d",&a);
gotoxy(26,2);scanf("%d",&b);
gotoxy(30,2);scanf("%d",&c);
gotoxy(34,2);scanf("%d",&d);
gotoxy(38,2);scanf("%d",&e);
gotoxy(42,2);scanf("%d",&f);
regla(8,3,66,26);
barra(10,24,a);
barra(20,24,b);
barra(30,24,c);
barra(40,24,d);
barra(50,24,e);
barra(60,24,f);
getch();

}