This program opens a website entered by the user. User can open any website .It will launch Mozilla Firefox web browser to open a website so it should be installed on your computer, if you are using an another web browser then you can change the path in the program.

C programming code

[pastacode lang=”c” manual=”%23include%20%3Cstdio.h%3E%0A%23include%20%3Cconio.h%3E%0A%23include%20%3Cstdlib.h%3E%0A%23include%20%3Cgraphics.h%3E%0A%23include%20%3Cdos.h%3E%0A%23include%20%3Cstring.h%3E%0A%20%0Avoid%20initialize_graphics_mode()%3B%0Aint%20get_key()%3B%0Avoid%20draw()%3B%0A%20%0Aunion%20REGS%20i%2C%20o%3B%0A%20%0Amain()%0A%7B%0A%20%20int%20key%2C%20i%20%3D%200%2C%20xpos%2C%20ypos%2C%20button%3B%0A%20%20char%20arr%5B200%5D%2C%20temp%5B5%5D%2C%20*ptr%3B%0A%20%20char%20a%5B%5D%20%3D%20%22C%3A%5C%5CProgra~1%5C%5CMozill~1%5C%5Cfirefox%20%22%3B%0A%20%0A%20%20strcpy(arr%2Ca)%3B%0A%20%0A%20%20i%20%3D%20strlen(a)%3B%0A%20%0A%20%20initialize_graphics_mode()%3B%0A%20%0A%20%20draw()%3B%0A%20%0A%20%20while(1)%0A%20%20%7B%0A%20%20%20%20if(kbhit())%0A%20%20%20%20%20%20key%20%3D%20get_key()%3B%0A%20%0A%20%20%20%20if((key%3E%3D97%26%26key%3C%3D122)%7C%7C(key%3E%3D65%26%26key%3C%3D90)%7C%7Ckey%3D%3D46%7C%7Ckey%3D%3D47%7C%7Ckey%3D%3D63)%0A%20%20%20%20%7B%0A%20%20%20%20%20%20arr%5Bi%5D%20%3D%20key%3B%0A%20%20%20%20%20%20sprintf(temp%2C%22%25c%22%2Carr%5Bi%5D)%3B%0A%20%20%20%20%20%20outtext(temp)%3B%0A%20%20%20%20%20%20if(getx()%3E470)%0A%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20clearviewport()%3B%0A%20%20%20%20%20%20%20%20moveto(5%2C2)%3B%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20i%2B%2B%3B%0A%20%20%20%20%7D%0A%20%20%20%20else%20if%20(%20key%20%3D%3D%2013%20)%0A%20%20%20%20%7B%0A%20%20%20%20%20%20arr%5Bi%5D%20%3D%20’%5C0’%3B%0A%20%20%20%20%20%20system(arr)%3B%0A%20%20%20%20%20%20break%3B%0A%20%20%20%20%7D%0A%20%20%20%20else%20if%20(%20key%20%3D%3D%2027%20)%0A%20%20%20%20%7B%0A%20%20%20%20%20%20closegraph()%3B%0A%20%20%20%20%20%20exit(EXIT_SUCCESS)%3B%0A%20%20%20%20%7D%0A%20%20%20%20if(button%3D%3D1%26%26xpos%3E%3D150%26%26xpos%3C%3D480%26%26ypos%3E%3D300%26%26ypos%3C%3D330)%0A%20%20%20%20%7B%0A%20%20%20%20%20%20system(%22C%3A%5C%5CProgra~1%5C%5CMozill~1%5C%5Cfirefox%20programmingsimplified.com%22)%3B%0A%20%20%20%20%20%20break%3B%0A%20%20%20%20%7D%0A%20%20%20%20key%20%3D%20-1%3B%0A%20%20%7D%0A%20%0A%20%20closegraph()%3B%0A%20%20return%200%3B%0A%7D%0A%20%0Avoid%20initialize_graphics_mode()%0A%7B%0A%20%20int%20gd%20%3D%20DETECT%2C%20gm%2C%20errorcode%3B%0A%20%0A%20%20initgraph(%26gd%2C%26gm%2C%22C%3A%5C%5CTC%5C%5CBGI%22)%3B%0A%20%20errorcode%20%3D%20graphresult()%3B%0A%20%0A%20%20if(%20errorcode%20!%3D%20grOk%20)%0A%20%20%7B%0A%20%20%20%20printf(%22Graphics%20error%20%3A%20%25s%5Cn%22%2Cgrapherrormsg(errorcode))%3B%0A%20%0A%20%20%20%20printf(%22Press%20any%20key%20to%20exit…%5Cn%22)%3B%0A%20%20%20%20getch()%3B%0A%20%20%20%20exit(EXIT_FAILURE)%3B%0A%20%20%7D%0A%7D%0A%20%0Aint%20get_key()%0A%7B%0A%20%20i.h.ah%20%3D%200%3B%0A%20%20int86(22%2C%26i%2C%26o)%3B%0A%20%0A%20%20return(%20o.h.al%20)%3B%0A%7D%0A%20%0Avoid%20draw()%0A%7B%0A%20%20settextstyle(SANS_SERIF_FONT%2CHORIZ_DIR%2C2)%3B%0A%20%20outtextxy(275%2C11%2C%22Web%20Browser%22)%3B%0A%20%20outtextxy(155%2C451%2C%22%3Ca%20href%3D%22http%3A%2F%2Fwww.programmingsimplified.com%22%22%3Ewww.programmingsimplified.com%22%3C%2Fa%3E)%3B%0A%20%20outtextxy(5%2C105%2C%22Enter%20URL%20%3A%20%22)%3B%0A%20%20rectangle(120%2C100%2C600%2C130)%3B%0A%20%20setviewport(121%2C101%2C599%2C129%2C1)%3B%0A%20%20moveto(5%2C1)%3B%0A%7D” message=”” highlight=”” provider=”manual”/] [ad type=”banner”]

Categorized in: