The Beginning.C, Turbo C++, and a Help Library.
This page is not a portfolio. It is a time capsule. Every program here was written before broadband, before Google, before someone else had already solved the problem. Just a student, a compiler, and an obsession.
The Day I Stopped Being Afraid of the Computer.
It was 2002. I had passed my Higher Secondary with First Division. I had never touched a computer. The machines were expensive, surrounded by mythology, and most people kept their distance. A conventional institute in Kolkata offered a Diploma in Programming — C and C++, taught through Turbo C. I enrolled.
The first few days were humbling. I stared at the keyboard. The monitor felt like it was watching me back. Then we reached conditions and loops — and something clicked inside my mind with the clarity of a mathematical proof. I walked up to my instructor with a handwritten formula I had used as a child: a trick for calculating what day of the week any birth date fell on. I asked if I could turn it into a program.
That program became everything. Not because it was complex — it wasn't. But because it was mine. Designed from a childhood memory. Converted into logic. Executed by a machine. The Turbo C help library — the only "Google" I had — became my closest companion. Every function, every trick I learned, came from pressing F1 and reading.
Birth Date Day Calculator.
My very first self-designed program. Not a tutorial exercise. A childhood formula — Zeller's congruence, though I didn't know its name then — that I had memorised to mentally calculate what day any birth date fell on. I converted it into C code, line by line, entirely from logic.
/* Birth Date Day Calculator — First self-designed program · 2002 */ #include <stdio.h> #include <conio.h> int dayOfWeek(int d, int m, int y) { static int t[] = {0,3,2,5,0,3,5,1,4,6,2,4}; if (m < 3) y--; return (y + y/4 - y/100 + y/400 + t[m-1] + d) % 7; } void main() { int d, m, y; char *days[] = {"Sunday","Monday","Tuesday","Wednesday", "Thursday","Friday","Saturday"}; clrscr(); printf("\n ===== BIRTH DATE CALCULATOR =====\n"); printf(" Enter Day (DD) : "); scanf("%d", &d); printf(" Enter Month (MM) : "); scanf("%d", &m); printf(" Enter Year (YYYY) : "); scanf("%d", &y); printf("\n The day was : %s\n", days[dayOfWeek(d,m,y)]); getch(); }
Program Input
Program Output
Program Running
The Day I Discovered cprintf.
Everyone starts with printf. Plain grey-white DOS output. That is all we knew. Then one afternoon, digging through Turbo C's built-in help library — the only "Google" we had — I found cprintf. Colour printf. Set text colour. Set background colour. Print in any combination of the 16 DOS colours.
Once I had colour, I couldn't stop. Every program got a colour scheme. Every output became a designed experience. The accelerator was found — and from here the speed of learning doubled.
/* Discovering cprintf — the first coloured output · 2002 */ #include <stdio.h> #include <conio.h> void main() { clrscr(); textcolor(CYAN); textbackground(BLACK); cprintf(" Hello in CYAN on BLACK! \r\n"); textcolor(YELLOW); textbackground(BLUE); cprintf(" Hello in YELLOW on BLUE! \r\n"); textcolor(WHITE); textbackground(RED); cprintf(" Hello in WHITE on RED! \r\n"); textcolor(BLACK); textbackground(GREEN); cprintf(" Hello in BLACK on GREEN! \r\n"); textcolor(MAGENTA);textbackground(LIGHTGRAY); cprintf(" Hello in MAGENTA on LIGHTGRAY! \r\n"); getch(); }
All 16 DOS Colors
Color Demo
Ferns, Space, UFOs. DOS Graphics.
After colour came graphics. Turbo C's graphics.h opened a completely different world. The DOS screen could now render pixels, lines, circles — and with a fractal algorithm, a Barnsley fern that grew on screen pixel by pixel. I was mesmerised. I spent weeks drawing: a starfield that scrolled like flying through space, a UFO that animated across the screen, and a simulated Mars landscape. All in C. All in DOS. All original, from the help library alone.
/* Barnsley Fern — fractal drawn pixel by pixel · 2003 */ #include <graphics.h> #include <stdlib.h> #include <conio.h> void main() { int gd = DETECT, gm; initgraph(&gd, &gm, "C:\\TC\\BGI"); double x=0, y=0, nx, ny; int i, r, px, py; setcolor(GREEN); for(i=0; i<100000; i++) { r = rand() % 100; if (r < 1) { nx=0; ny=0.16*y; } else if (r < 86) { nx=0.85*x+0.04*y; ny=-0.04*x+0.85*y+1.6; } else if (r < 93) { nx=0.20*x-0.26*y; ny= 0.23*x+0.22*y+1.6; } else { nx=-0.15*x+0.28*y; ny= 0.26*x+0.24*y+0.44; } x=nx; y=ny; px=(int)(x*40)+320; py=getmaxy()-(int)(y*37); putpixel(px, py, GREEN); } getch(); closegraph(); }
Fern Rendered
Fern Growing
/* Starfield + UFO animation — DOS graphics · 2003 */ #include <graphics.h> #include <stdlib.h> #include <conio.h> #include <dos.h> #define STARS 150 int sx[STARS], sy[STARS]; void drawUFO(int x, int y) { setcolor(CYAN); ellipse(x,y,0,360,30,10); setcolor(YELLOW); ellipse(x,y-8,0,360,14,8); setcolor(WHITE); circle(x,y-8,4); } void main() { int gd=DETECT,gm,i,ux=50,uy=100; initgraph(&gd,&gm,"C:\\TC\\BGI"); for(i=0;i<STARS;i++){sx[i]=rand()%640;sy[i]=rand()%480;} while(!kbhit()) { cleardevice(); for(i=0;i<STARS;i++){ putpixel(sx[i],sy[i],WHITE); sy[i]=(sy[i]+2)%480; } drawUFO(ux,uy); ux=(ux+3)%getmaxx(); delay(30); } closegraph(); }
Starfield
UFO Animation
Full Animation
Chatting With an Alien on Mars.
No internet. No chatbot APIs. So I built my own. A simulated conversation with an alien life form on Mars — rendered in DOS graphics mode with the alien's face drawn using graphics.h, and a text-based response tree handling the conversation. You typed. The alien responded. It was storytelling, logic, and graphics all in one program. All original.
/* Mars Alien Chat Simulation · DOS Graphics · 2003 */ #include <stdio.h> #include <string.h> #include <conio.h> #include <graphics.h> char *resp[] = { "Zrrk! Greetings, Earth creature.", "We have monitored your planet for 3000 cycles.", "Your gravity is... uncomfortable.", "Zrrk... does not compute." }; void drawAlien(int x, int y) { setfillstyle(SOLID_FILL,GREEN); fillellipse(x,y,25,30); setcolor(RED); circle(x-10,y-5,5); circle(x+10,y-5,5); setcolor(YELLOW);arc(x,y+8,190,350,12); } void respond(char *in) { if (strstr(in,"hello")||strstr(in,"hi")) printf("\n ALIEN> %s",resp[0]); else if(strstr(in,"mars")||strstr(in,"planet")) printf("\n ALIEN> %s",resp[1]); else if(strstr(in,"earth")||strstr(in,"gravity"))printf("\n ALIEN> %s",resp[2]); else printf("\n ALIEN> %s",resp[3]); } void main() { char input[80]; int gd=DETECT,gm; initgraph(&gd,&gm,"C:\\TC\\BGI"); drawAlien(320,120); getch(); closegraph(); while(1){ printf("\n YOU> "); gets(input); if(!strcmp(input,"bye")) break; respond(input); } }
Alien Face Rendered
Full Chat Session
When Others Scored 30, I Scored 80+.
By 2003, C and C++ had become second nature. The institute's 100-mark programming examinations exposed the gap clearly. Other students struggled to cross 30–40. My score never fell below 80. Not because I studied harder — but because I had gone far beyond the syllabus on my own, driven purely by curiosity about what the language could do.
Consistently Highest in C & C++ · Institute Examinations · 2003–2004
100-mark papers. Class average: 30–40. Personal average: 80+. Score never dropped below 80 in any C or C++ paper across the entire course. Not studying more — building more.
This wasn't academic performance. It was the natural result of spending evenings drawing fractal ferns and animating UFOs while the curriculum was still on printf("Hello, World");.
When DOS Got a GUI. Built from Scratch.
Visual Basic 6 had arrived in the curriculum. Everyone marvelled at the GUI — forms, buttons, message boxes, all provided automatically. I used it. I understood it. And then I asked myself a question that would consume months: Can I build a GUI in DOS mode, in C, from scratch?
Days turned into nights. The code grew: 7,000 lines, then 8,000. I built two custom header files — gcpp.h and gcpp2.h — a complete graphical interface library for DOS mode. Include these two files and in ten lines you had a fully functional GUI: windows, 3D buttons, input fields, dialog boxes, colour fills, event handling.
/* gcpp.h — Graphical C++ DOS GUI Library · ~7000 lines · 2004 Include this header: get a full DOS GUI in under 15 lines */ #ifndef GCPP_H #define GCPP_H #include <graphics.h> #include <conio.h> #include <string.h> #include <stdlib.h> #define BTN_FACE 7 #define BTN_SHADOW 8 #define BTN_HILITE 15 #define WIN_BG 1 /* ── Draw a 3D raised button ──────────────────────── */ void drawButton(int x,int y,int w,int h,char* label) { setfillstyle(SOLID_FILL,BTN_FACE); bar(x,y,x+w,y+h); setcolor(BTN_HILITE); line(x,y,x+w,y); line(x,y,x,y+h); setcolor(BTN_SHADOW); line(x,y+h,x+w,y+h); line(x+w,y,x+w,y+h); setcolor(BLACK); outtextxy(x+(w/2)-(strlen(label)*4), y+(h/2)-4, label); } /* ── Draw a window with title bar ─────────────────── */ void drawWindow(int x,int y,int w,int h,char* title) { setfillstyle(SOLID_FILL,WIN_BG); bar(x,y,x+w,y+h); setfillstyle(SOLID_FILL,BTN_FACE); bar(x,y,x+w,y+18); setcolor(WHITE); outtextxy(x+4,y+4,title); setcolor(BTN_HILITE); rectangle(x,y,x+w,y+h); } /* ... (7000+ more lines: input boxes, radio buttons, checkboxes, menus, scroll bars, message boxes, event loop) */ #endif
/* Full DOS GUI in 12 lines — using gcpp.h + gcpp2.h */ #include "gcpp.h" #include "gcpp2.h" void main() { int gd=DETECT, gm; initgraph(&gd, &gm, "C:\\TC\\BGI"); drawWindow(100,80,440,300,"My DOS Application"); drawButton(180,200,100,30,"OK"); drawButton(310,200,100,30,"Cancel"); getch(); closegraph(); }
DOS Window
3D Buttons
Full GUI Demo
DebB Paint. My Own MS Paint. In DOS.
With the GUI library working, I pushed to the ultimate challenge: build a fully working paint application — like Microsoft MS Paint — running entirely in DOS graphics mode, in C. I called it DebB Paint.
It had everything: draw squares, rectangles, and circles with a single click. Select colour from a palette with a click. Flood-fill shapes. Emboss effect. Engrave effect. A toolbox panel. Keyboard shortcuts. Save and reload drawings. It was the largest single program I had ever written.
/* DebB Paint — DOS Paint App · 2004 Draw, Fill, Emboss, Engrave, Color Picker, Toolbox */ #include "gcpp.h" #include "gcpp2.h" #include <dos.h> #define TOOL_RECT 1 #define TOOL_CIRC 2 #define TOOL_FILL 3 #define TOOL_EMBOSS 4 #define TOOL_ENGRAV 5 int curTool=TOOL_RECT, curColor=WHITE; void emboss(int x1,int y1,int x2,int y2) { setcolor(WHITE); line(x1,y1,x2,y1); line(x1,y1,x1,y2); setcolor(DARKGRAY); line(x1,y2,x2,y2); line(x2,y1,x2,y2); } void engrave(int x1,int y1,int x2,int y2) { setcolor(DARKGRAY); line(x1,y1,x2,y1); line(x1,y1,x1,y2); setcolor(WHITE); line(x1,y2,x2,y2); line(x2,y1,x2,y2); } void drawPalette() { int i,cols[]={BLACK,BLUE,GREEN,CYAN,RED,MAGENTA, BROWN,LIGHTGRAY,DARKGRAY,YELLOW,WHITE, LIGHTBLUE,LIGHTGREEN,LIGHTCYAN,LIGHTRED,LIGHTMAGENTA}; for(i=0;i<16;i++){ setfillstyle(SOLID_FILL,cols[i]); bar(10+i*20,getmaxy()-28,28+i*20,getmaxy()-10); } } void main() { int gd=DETECT,gm; initgraph(&gd,&gm,"C:\\TC\\BGI"); drawWindow(0,0,getmaxx(),getmaxy(),"DebB Paint v1.0"); drawPalette(); /* Full event loop: mouse click → tool action → draw → fill... */ getch(); closegraph(); }
DebB Paint UI
Drawing Demo
Shapes
Fill + Color
Emboss Effect
STORY_STATUS: ONGOING // INIT_2002 · STILL_BUILDING · EST_PRESENT
This Was the Beginning.
The Story Didn't Stop Here.
From Turbo C to enterprise software, from DOS graphics to AI agents — every chapter built on this foundation.
hello@debasisbhattacharjee.com · +91 8777088548