Skip to content

Instantly share code, notes, and snippets.

@w3Abhishek
Created July 28, 2021 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save w3Abhishek/11a5446127bac5afb4ec549cb8beb673 to your computer and use it in GitHub Desktop.
Save w3Abhishek/11a5446127bac5afb4ec549cb8beb673 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <conio.h>
#include <graphics.h>
#include <string.h>
#include <dos.h>
int main() {
int gd = DETECT, gm;
int i, midx, midy, count;
char string[100];
printf("Enter a Number\n");
scanf("%d", &count);
initgraph(&gd, &gm, "X:\\TC\\BGI");
midx = getmaxx()/2;
midy = getmaxy()/2;
for (i = 0; i <= count; i++) {
setcolor(WHITE);
setfillstyle(SOLID_FILL, WHITE);
rectangle(midx - 50, midy - 50, midx + 50, midy + 50);
floodfill(midx, midy, WHITE);
setcolor(BLUE);
sprintf(string, "%s", "Counter");
settextstyle(SANS_SERIF_FONT, HORIZ_DIR, 5);
settextjustify(CENTER_TEXT, CENTER_TEXT);
outtextxy(midx, midy - 100, "Counter");
sprintf(string, "%d", i);
outtextxy(midx, midy, string);
delay(1000);
cleardevice();
}
getch();
closegraph();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment