I tried to create bars, but the output is just bars, and I want to move the bars up and down like a visual equalizer, but I don't know the exact code for that. Does anyone know it?
Here's a picture:
And my attempt:
#include <stdio.h>
#include <conio.h>
#include <dos.h>
#include <stdlib.h>
#include <graphics.h>
void main(){
int gd = DETECT, gm;
initgraph(&gd,&gm, “D:\\TC\\BGI”);
randomize();
int x = 100;
int y,a;
setfillstyle(2,GREEN);
do{
delay(100);
y = random(150);
if ((200-y) >=a){
setfillstyle(2,BLACK);
bar (x,200-y,x+20,a);
}
else {
bar (x,200,x+20,200-y);
}
a = 200-y;
}
while(!kbhit());
getch();
closegraph();
}