Draw Google Home Page



We can create so many objects using c-graphics as we have already discussed in previous month.Here we are going to create a google home page using some basic c-graphics functions.Here is code of c-graphics programming for drawing google homepage:

#include<stdio.h>

#include<conio.h>

#include<graphics.h>

void main()

{

int gd=DETECT,gm;

initgraph(&gd,&gm,"");

setbkcolor(WHITE);

setcolor(CYAN);

settextstyle(3,HORIZ_DIR,10);

outtextxy(120,123,"G");

settextstyle(3,HORIZ_DIR,8);

setcolor(LIGHTRED);

outtextxy(185,163,"O");

setcolor(YELLOW);

outtextxy(230,163,"O");

setcolor(CYAN);

settextstyle(3,HORIZ_DIR,8);

outtextxy(280,151,"g");

setcolor(GREEN);

settextstyle(3,HORIZ_DIR,9);

outtextxy(330,151,"l");

setcolor(LIGHTRED);

outtextxy(340,146,"e");

settextstyle(5,HORIZ_DIR,1);

setcolor(LIGHTGRAY);

outtextxy(329,240,"India");

rectangle(50,250,480,270);

rectangle(120,290,240,320);

rectangle(270,290,430,320);

setcolor(DARKGRAY);

settextstyle(7,HORIZ_DIR,1);

outtextxy(130,305,"Google Search");

outtextxy(280,305,"I'm Feeling Lucky");

outtextxy(10,350,"Google.co.in.offered.in");

setcolor(BLUE);

outtextxy(200,350,"Hindi Bengali Telgu Gujrati Malayalam Punjabi");

getch();

closegraph();

}



The above code is used to create a google home page on our output screen.In this program we have used basically three functions setcolor,settextstyle and outtextxy.setcolor function is used to set the drawing color or foreground color.settextstyle function is used to set the style,size and direction of text.outtextxy function is used for print the text at specified location.Other then these functions setbkcolor is used for changing the background color and rectangle function is used to draw a rectangle.To get more information about these tutorials you can go through our tutorial Graphics in C.The output of the above program will be as follows:



Output

c_graphics