Ads

BROWSERS PIE CHART IN C++ PROGRAMMING | PIE CHART IN C PROGRAMMING | C++ GRAPHICS PROGRAMMING

 


//........... WELCOME ALL OF YOU ON ROHIT TECH STUDY CHANNEL ..............//

/************* C++ PROGRAM TO CREATE BROWSERS PIE CHART ******************/


#include <stdio.h>

#include <conio.h>

#include <graphics.h>

#include <dos.h>

int main()

{


int gdriver = DETECT, gmode, err;

int midx, midy;

char str[64];


initgraph(&gdriver, &gmode, "C:/TC/BGI");

err = graphresult();

if (err != grOk)

{

printf("Graphics Error: %s",grapherrormsg(err));

return 0;

}


settextstyle(1,0,4);

setcolor(14);

outtextxy(120,5,"PIE CHART FOR BROWSERS");


// mid positions in x and y-axis


midx = getmaxx() / 2;

midy = getmaxy() / 2;


// pie slice representing safari


delay(500);

setcolor(12);

setfillstyle(CLOSE_DOT_FILL, 12);

pieslice(midx, midy, 0, 40, 100);


// pie slice representing firefox


delay(400);

setcolor(10);

setfillstyle(LINE_FILL, 10);

pieslice(midx, midy, 45, 140, 100);


// pie slice representing opera


delay(500);

setcolor(14);

setfillstyle(WIDE_DOT_FILL, 14);

pieslice(midx, midy, 145, 200, 100);


// pie slice representing chrome


delay(400);

setcolor(11);

setfillstyle(SLASH_FILL, 11);

pieslice(midx, midy, 205, 300, 100);


// pie slice representing internet explorer


delay(500);

setcolor(15);

setfillstyle(BKSLASH_FILL, 15);

pieslice(midx, midy, 305, 355, 100);



// naming pie slice with corresponding names


delay(400);

setcolor(WHITE);

settextstyle(TRIPLEX_FONT, HORIZ_DIR, 3);

settextjustify(CENTER_TEXT, CENTER_TEXT);


sprintf(str, "%s", "SAFARI");

moveto(midx + 140, midy - 40);

outtext(str);


delay(500);

sprintf(str, "%s", "FIREFOX");

moveto(midx, midy - 130);

outtext(str);


delay(400);

sprintf(str, "%s", "OPERA");

moveto(midx - 140, midy);

outtext(str);


delay(500);

sprintf(str, "%s", "CHROME");

moveto(midx - 20, midy + 110);

outtext(str);


delay(400);

sprintf(str, "%s", "IE");

moveto(midx + 120, midy + 40);

outtext(str);


delay(500);

setcolor(YELLOW);


getch();

closegraph();

return 0;

}



/****************** I HOPE YOU LIKE THIS PROGRAMMING ******************/

/*------------- LIKE ---------- SHARE ---------- SUBSCRIBE -------------*/


Download source code



Post a Comment

0 Comments