Anda di halaman 1dari 25

KU 5TH SEM PRACTICAL SOLUTIONS By: Rajiv Phukan ( ) Pathsala( )

Set 1
//1. O p e n a n I m a g e. A n d s e p a r a t e b a c k g r o u n d u s i n g s elec ti o n t o o l. Step 1: run Photoshop Step 2: go to file menu -> open Step 3 : select image ->click open Step 4: click on magic wand tool from tool menu Step 5 : select on background of the image using magic wand tool Step 6 : press delete on keyboard Step 7: go to file menu -> save as Step 8 : select JPEG format Step 9: enter file name -> click SAVE //2. W r i t e a J S P p a ge t o di s p l a y t h e n u m b e r o f h i t s t o t h i s p a g e. ( H i n t : u s e a p p l ic a t i o n s co p e o f j a v a be a n ) . <%@ page session="false" %> <HTML> <HEAD> <TITLE>Page Counter Using URL Rewriting</TITLE> </HEAD> <BODY> <H3 >Page Counter Using URL Rewriting</H3 > <% int count = 0; String parm = request.getParameter("count"); if (parm != null) count = Integer.parseInt(parm); if (count == 0) { %> This is the first time you have accessed this page. <% } else if (count == 1) {

%> You have accessed the page once before.<% } else { %> You have accessed the page <%= count %> times before.<% } %> <P> Click <A HREF="urlrewriting.jsp?count=<%=count + 1 %>" >here</A> to visit the page again. </BODY> </HTML>

Set 2
//1. U s i n g p e n cil t o o l c r e a t e a n i m a g e o f l a n d s c a p e, a n d colo r i t w i t h B r u s h t o o l. Step 1: run Photoshop Step 2: click file menu -> new -> select size -> press OK Step 3 : in dialog box, click on preset -> select landscape in size box -> press OK Step 4: click on pencil tool in tool menu Step 5 : draw an image in landscape using pencil tool Step 6 : right click on pencil tool and select brush tool Step 7: using brush tool, fill the color in landscape image Step 8 : go to file menu -> save as Step 9: select JPEG format Step 10: enter file name -> click SAVE //2. C r e a t e a n H TM L p a ge co n t a i n i n g t h e f o ll o w i n g f e a t u r e s a. C r e a t e a logi n J S P p a ge w i t h u s e r n a m e , p a s s w o r d a n d s u b m i t b u t t o n. b. O n s u b m i t , d i s p l a y m e s s a g e T h a n k yo u f o r loggi n g i n a l s o c r e a t e coo k i e s t o s t o r e u s e r n a m e a n d p a s s w o r d. c. O p e n logi n J S P p a ge o n a n e w b r o w s e r. I f t h e coo k i e i s p r e s e n t t h e u s e r n a m e a n d p a s s w o r d f i el d s h o u l d be a u t o m a t i c al l y p o p u l a t e d w i t h t h e v a l u e s f r o m t h e coo k i e. <%@page contentType="text/html"%> <html>

<head> <title></title> </head> <body> <center> <form action="next.jsp" method="post"> Please Enter Your Detials !<br> First Name Last Name </form> </center> </body> </html> N e x t.j s p <%@page contentType="text/html"%> <%@page pageEncoding="UTF-8 "%> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8 "> <title>JSP Page</title> </head> <body> <% String firstname=request.getParameter("firstname"); String lastname=request.getParameter("lastname"); out.println("<font color=blue>Welcome</font> loging in!"); %> </body> </html> "+firstname+" "+lastname+" Thank you for <input type="text" name="firstname"><br> <input type="text" name="lastname"><br>

<input type="submit" name="submit" value="Submit">

Set 3

//1. W r i t e a J S P p r o g r a m t o di s p l a y c u r r e n t d a t e a n d t i m e a n d s u i t a bl e w e l co m e m e s s a g e. a. If t i m e i s be t w e e n 5 AM a n d 12 P M di s p l a y w e l co m e m e s s a ge a s G oo d Mor n i n g b. If t i m e i s be t w e e n 12 P M a n d 5 P M d i s p l a y w e l c o m e m e s s a ge a s G oo d A f t e r n o o n c. A f t e r 5 PM d i s p l a y m e s s a g e a s G o o d e ve n i n g. <%@page language="java"%> <html> <head> <title>Welcome</title> </head> <body> <h1> <% java.util.Date d=new java.util.Date(); int time=d.getHours(); if(time>5 && time<12) out.println("\n Good Morning !"); esle if(time>12 && time<17) out.println("\n Good Afternoon !"); else if(time>17) out.println("\n Good Evening !"); %> </h1> current time is :<%=d.getHours()%>:<%=d.getMinutes()%> </body> </html> //2. U s i n g R u b b e r s t a m p t o o l , c r e a t e a clo n e i m a g e Step 1: run Photoshop Step 2: go to file menu -> open Step 3 : select image -> click open Step 4: select rubberstamp tool from tool menu Step 5 : press ALT then left click on image to begin Step 6 : click on the image and drag where you want to make clone of that image Step 7: go to file -> save as

Step 8 : select JPEG format Step 9: enter file name -> click SAVE

Set 4
//1. U s i n g G r a d i e n t t o o l , c r e a t e s o m e b a c k g r o u n d s f o r p h o t o s. Step 1: run Photoshop Step 2: go to file menu -> new -> select size -> press ok Step 3 : select gradient tool from tool menu Step 4: choose gradient (linear/ radial/ angle/ diamond) from option toolbar Step 5 : press left click on mouse then drag on image to create gradient Step 6 : go to file -> save as Step 7: select JPEG format Step 8 : enter file name -> click SAVE //2. .C r e a t e a n H TM L p a g e co n t a i n i n g t h e f o l l o w i n g f e a t u r e s a. A co m b o b ox co n t a i n i n g t h e li s t o f 7 colo r s : V i o l e t , I n di go, B l u e, G r e e n , Ye l l o w, O r a n g e, R e d b. D e p e n d i n g u p o n t h e colo r s elec t e d f r o m t h e a b o ve co m b o b ox, t h e m e s s a ge i n t h e s t a t u s b a r o f t h e w i n d o w m u s t be r e f l ec t t h e v a l u e s el ec te d i n t h e co m b o b ox ( h i n t : o n c h a n ge e ve n t o f t h e co m b o b ox ). <html> <head> <title>Showing Message in Status Bar</title> </head> <body> <script language="JavaScript"> functionfn() { num=document.frm.vibgyor.selectedIndex; if(num==0) { window.status="You have selected Violet."; } if(num==1) { window.status="You have selected Indigo.";

} if(num==2) { window.status="You have selected Blue."; } if(num==3 ) { window.status="You have selected Green."; } if(num==4) { window.status="You have selected Yellow."; } if(num==5 ) { window.status="You have selected Orange."; } if(num==6 ) { window.status="You have selected Red."; } } </script> <form name="frm"> <select name="vibgyor" onChange=fn()><option>Violet</option> <option>Indigo</option> <option>Blue</option> <option>Green</option> <option>Yellow</option> <option>Orang</option> <option>Red</option> </select> </form> </body>

</html>

Set 5
//1. C r e a t e a n H TM L p a ge co n t a i n i n g t h e f o ll o w i n g f e a t u r e s a. A co m b o b ox co n t a i n i n g t h e li s t o f 7 colo r s : V i o l e t , I n di go, B l u e, G r e e n , Ye l l o w, O r a n g e, R e d b. A n e m p t y 1X1 t a bl e w i t h d ef a u l t b a c k g r o u n d colo r : W h i t e c. D e p e n d i n g u p o n t h e colo r s el ec te d f r o m t h e a b o v e co m b o b ox, t h e b a c k g r o u n d o f t h e t a bl e m u s t b e c h a n ge d a cco r d i n g l y. ( h i n t : o n c h a n g e e ve n t o f t h e co m b o b ox ). <html> <head> <title> Changing Table Color by selecting color from the ComboBox </title> </head> <body> <script language= "JavaScript"> functionfn() { num=document.frm.vibgyor.selectedIndex; if(num==0) } if(num==1) { document.getElementById("tab").bgColor="Indigo"; } if(num==2) } if(num==3 ) { document.getElementById("tab").bgColor="Green"; } if(num==4) { document.getElementById("tab").bgColor="Blue"; { document.getElementById("tab").bgColor="Violet";

{ document.getElementById("tab").bgColor="Yellow"; } if(num==5 ) { document.getElementById("tab").bgColor="Orange"; } { document.getElementById("tab").bgColor="Red"; } } </script> <form name="frm"> <select name="vibgyor" onChange=fn()> <option>Violet</option> <option>Indigo</option> <option>Blue</option> <option>Green</option> <option>Yellow</option> <option>Orange</option> <option>Red</option> </select><br><br><br><br> <table id="tab" border="1"> <tr> <th>Name</th> <th>Registration Number</th> </tr> <tr> <td>priyanka rani</td> <td>072B5 725 </td> </tr> </table> </form> </body> if(num==6 )

</html> //2. I m p o r t a J P E G f o r m a t i m a g e a n d s a v e i t a s a P S D i m a g e, u s i n g l a ye r o p ti o n s D ec r e a s e t h e o p a ci t y o f i m a g e. T i p s : C t r l + S h i f t + S = s a ve a s w i n d o w Step 1: run Photoshop Step 2: go to file menu -> open Step 3 : select a JPEG image -> click open Step 4: go to layer -> new -> click on layer from background Step 5 : enter layer name in dialog box -> press OK Step 6 : press F7 then decrease opacity Step 7: go to file -> save as Step 8 : select PSD format Step 9: enter file name -> click SAVE

Set 6
//1. O p e n a P O R T R A I T i m a ge , co n ve r t i t i n t o g r a y s c a l e. N o w colo r t h e i m age Using CO LO R B A L A N C E , L E V E L S a nd C U RV E S Step 1: run Photoshop Step 2: go to file menu -> open Step 3 : select a portrait JPEG image ->click open Step 4: go to image -> mode -> click on Grayscale Step 5 : click discard in message box Step 6 : go to image -> adjustments -> image -> click on curves Step 7: adjust curves -> press OK Step 8 : go to file -> save as Step 9: select JPEG format Step 10: enter file name -> click SAVE //2. W r i t e a H TM L p a ge co n t a i n i n g a n H TM L f o r m t o c a p t u r e t h e f o l l o w i n g p roper ties f ro m t he u ser: a. N a m e ( t ex t b ox ) b. A d d r e s s ( t ex t a r e a ) c. P h o n e ( t ex t b ox ) Write j av a scrip t f u nctions a. t o v a l i d a t e N a m e t o co n t a i n o n l y a l p h a b e t s a n d o f m a x i m u m le n g t h

s h o u l d be 25 ; S h o w a p p r o p r i a t e m e s s a ge s o n f a il u r e b. t o v a l i d a t e A d d r e s s f i el d t o co n t a i n m a xi m u m le n g t h o f 200 c h a r a c t e r s ; S h o w a p p r o p r i a t e o n f ai l u r e a n d f o c u s t h e A d d r e s s f i el d t ex t area c. t o v a l i d a t e p h o n e n u m b e r t o co n t a i n o n l y n u m e r i c d a t a ; s h o w a p p r o p r i a t e m e s s a g e s o n f a il u r e <html> <head> <title> HTML form </title> <Script language="javaScript"> function f() { var name=document.f1.Name.value; var phone=document.f1.Phone.value; var address=document.f1.Address.value; if(name.length=="") { alert("Please enter name"); name.focus(); return; } if (name.length> 25 ) { alert("Name Field cannot contain more than 25 characters"); name.focus(); return; } if (!isNaN(name)) { alert("Name field must be filled with only Alphabets"); name.focus(); return; }

if(phone.length=="") { alert("Please enter phone numbar"); phone.focus(); return; } if (isNaN(phone)) { alert("Phone Number must be numeric"); phone.focus(); return; } if(address.length=="") { alert("Please enter address"); address.focus(); return; } if (address.length> 200) { alert("Address Field can contain maximum of 200 character"); } } </script> </head> <body bgcolor="pink"> <marquee><h1 align="center">A Sample FORM </h1></marquee> <form name=f1> Name:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type=textbox name="Name"><br> Phone:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type=textbox name="Phone"><br> Address:&nbsp;&nbsp;<textarea rows="5 " cols="5 0" name="Address"></textarea><BR>

<input type=Button name=''Button" value ="Submit" onclick=f()> </form> </body> </html>

Set 7
//1. C r e a t e t w o H TM L p a ge s a. F i r s t p a ge w i t h t h e f o l l o w i n g f e a t u r e s i. A n i m a g e ( l o go ) w i t h a co m p a n y n a m e a s t h e h e a d i n g i n t h e t o p ce n t e r ii. T h i s p a g e co n t a i n i n g a n H TM L f o r m , t w o t ex t b o xe s t o ge t F i r s t N a m e , S e co n d N a m e o f t h e u s e r iii. A s u b m i t b u t t o n t o t h e s u b m i t t h e d a t a t o t h e n ex t p a ge b. T h e S e c o n d p a g e r ecei ve s t h e d a t a s u b m i t t e d b y t h e F i r s t P a g e , d i s p l a y s t h e f o ll o w i n g m e s s a ge We l co m e <La s t N a m e>, <Fi r s t N a m e> <html> <head> <title></title> </head> <body> <center><img src="NIITLogo.jpg"></center> <center> <form action="ToShowDataToAnotherPage" method="post"> Please Enter Your Detials !<br> First Name Last Name </form> </center> </body> </html> ToShowDataToAnotherPage servlet import java.io.*; import java.net.*; importjavax.servlet.*; importjavax.servlet.http.*; <input type="text" name="firstname"><br> <input type="text" name="lastname"><br>

<input type="submit" name="submit" value="Submit">

public class ToShowDataToAnotherPage extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throwsServletException, IOException { response.setContentType("text/html;charset=UTF-8 "); PrintWriter out = response.getWriter(); String firstname=request.getParameter("firstname"); String lastname=request.getParameter("lastname"); out.println("<font color=blue>Welcome</font> } } //2. O p e n a p o r t r a i t , s elec t t h e e ye b a l l s u s i n g m a r q u ee t o o l , a n d n o w c h a n ge t h e colo r o f e ye s u s i n g H u e / s a t u r a t i o n. T i p s : C t r l + U = H ue / s a t u r a t i o n Step 1: run Photoshop Step 2: go to file menu -> open Step 3 : select image ->click open Step 4: click on marquee tool from tool menu Step 5 : select eyeball from the image using marquee tool Step 6 : press CTRL+U Step 7: adjust HUE AND SATURATION from dialog box -> press OK Step 8 : go to file -> save as Step 9: select JPEG format Step 10: enter file name -> click SAVE "+firstname+" "+lastname);

Set 8
//1. O p e n 3 t o 4 i m a ge s i n a s a m e l a ye r. U s i n g f i l t e r e f f ec t s c r e a t e c r e a t i v e b a c k g r o u n d s f o r b oo k co ve r p a g e. Step 1: run Photoshop Step 2: go to file menu -> new -> select background size -> press OK Step 3 : go to filter -> noise -> add noise Step 4: adjust amount in noise dialog box -> press OK

Step 5 : go to file menu -> open Step 6 : select 3 -4 images -> click open Step 7: select images, copy and paste them in background one by one Step 8 : go to file -> save as Step 9: select JPEG format Step 10: enter file name -> click SAVE //2. C r e a t e a H TM L p a ge t o di s p l a y a li s t o f f i l m s o n g s a v a i l a bl e i n t h e li b r a r y. T h e f o l l o w i n g a r e f e a t u r e s o f t h e p a g e a. T h e n a m e o f t h e s o n g s m u s t be h y p e r li n k e d t o t h e s o n g s , s o t h a t t h e u s e r s m u s t be a bl e t o d o w n l o a d s o n g s. b. T h e f o l l o w i n g i s t h e s o n g d a t a b a s e a v a i l a bl e i n t h e li b r a r y: c. L i b r a r y N a m e : H a r i h a r a n Mu s ic S i t e Slno Song Na me Fil m A r tis te 1 PA T A-PA T A A p t h a mit r a Udith N a r ayan 2 K a n a K a n ade A p t h a m i t r a Mad h u b a l a k r i s h n a 3 A n k u Don k u A p t h a mit r a S P B alas ub ra m a ny a m 4 Kalavanu T h a d e yo r u A p t h a m i t r a H a r i h a r a n 5 Bo m be A n ayya Unknown <html> <head> <tittle> Hiriharan Songs Site </title> </head> <body> <marquee><font color = blue><b>Welcome to Hariharan's Songs Site</b></font></marquee> <center> <table border=1> <tr> <th>S.No.</th> <th>Song Name</th> <th>Film</th> <th>Artist</th> <tr> <tr> <td>1.</td>

<td><a href="song1.html">Patta-Patta</a></td> <td>Apthamitra</td> <td>Udit Narayan</td> </tr> <tr> <td>2.</td> <td><a href="song2.html">Kana Kanede</a></td> <td>Apthamitra</td> <td>Madhubalakirishna</td> </tr> <tr> <td>3 .</td> <td><a href="song3 .html">AnkuDonku</a></td> <td>Apthamitra</td> <td>S P Balasupramanniyam</td> </tr> <tr> <td>4.</td> <td><a href="song4.html">Bombay</a></td> <td>Anaya</td> <td>Unknown</td> </tr> </table> </center> </body> </html>

Set 9
//1. C r e a t e a n H TM L p a ge t o di s p l a y t h e f o ll o w i n g d a t a u s i n g <ta bl e></t abl e> t a g s First Na me S hiva P r at ap S reenivas <html> Last Na me Rama S G City My s o r e Me rc a r a P hone N u m ber 08212569964 B a ng alore 08025689754 08965445454

<head> </head> <tittle> Data Table </title> <body> <table border=1> <tr> <th>First Name</th> <th>Last Name</th> <th>City</th> <th>Phone Number</th> <tr> <tr> <td>Shiva</td> <td>Rama</td> <td>Mysore</td> <td>08 2125 6 996 4</td> </tr> <tr> <td>Pratap</td> <td>S</td> <td>Bangalore</td> <td>08 025 6 8 975 4</td> </tr> <tr> <td>Shrinivas</td> <td>G</td> <td>Mercara</td> <td>08 96 5 445 45 4</td> </tr> </table> </body> </html>

//2. O p e n a n i m a ge a n d a d j u s t a l e ve l o f i m a g e. T i p s : C t r l + L = le vel Step 1: run Photoshop Step 2: go to file menu -> open Step 3 : select an image -> click open Step 4: go to image -> adjustments -> click on level or press ctrl + l Step 5 : adjust level -> press OK Step 6 : go to file -> save as Step 7: select JPEG format Step 8 : enter file name -> click SAVE

S e t 10
//1. W r i t e H TM L s c r i p t t o di s p l a y Hello Wo r l d , We l co m e t o t h e w o r l d o f H TM L . P u t t h e t i t l e a s Wo r l d o f H TM L <html> <head> </head> <title> Welcome to the world of HTML </title> <body> <i>"Hello World</i><b>Welcome to the world of HTML"</b> </body> </html> //2. C h a n ge a n i m a g e s ize 22 c m x 29 c m t o 44 c m x 58 c m . a n d r e s o l u t i o n 72 t o 300. Step 1: run Photoshop Step 2: go to file menu -> open Step 3 : select an image with 22 cm x 29 cm size -> click open Step 4: go to image -> image size Step 5 : change image size to 44 cm x 5 8 cm size with 100 resolutions -> press OK Step 6 : go to file -> save as Step 7: select JPEG format Step 8 : enter file name -> click SAVE

S e t 11
//1. C r e a t e s o m e geo m e t r i c al s h a p e s , u s i n g s h a p e t o o l. Step 1: run Photoshop Step 2: go to file menu -> new -> select size -> press OK Step 3 : click on custom shape tool from tool menu Step 4: click on custom shape picker in options toolbar Step 5 : click on smart tag -> select all then click append Step 6 : choose shape from option toolbar Step 7: left click on background and drag mouse to draw shape Step 8 : go to file -> save as Step 9: select JPEG format Step 10: enter file name -> click Save

S e t 12
//1. T y p e t ex t G R A D A T I O N a n d a p p l y g r a d ie n t t o o l o n t ex t. Step 1: run Photoshop Step 2: go to file menu -> new -> select size -> click OK Step 3 : click on text from tool menu Step 4: type text GRADATION Step 5 : click on layer from layer property Step 6 : right click on selected layer and click on blending options Step 7: click and check on gradient overlay Step 8 : adjust gradient or change angle to 0o -> then press OK Step 9: go to file menu -> save as Step 10: select JPEG format Step 11: enter file name -> click SAVE //2. C r e a t e a n H TM L p a ge t o d i s p l a y t h e f o ll o w i n g d a t a u s i n g <ta bl e></t abl e> t a g s First Na me Last Na me City P hone N u m ber S hiva Rama My s o r e 08212569964 P r at ap S B a ng alore 08025689754 S reenivas G Me rc a r a 08965445454 <html> <head>

</head> <tittle> Data Table </title> <body> <table border=1> <tr> <th>First Name</th> <th>Last Name</th> <th>City</th> <th>Phone Number</th> <tr> <tr> <td>Shiva</td> <td>Rama</td> <td>Mysore</td> <td>08 2125 6 996 4</td> </tr> <tr> <td>Pratap</td> <td>S</td> <td>Bangalore</td> <td>08 025 6 8 975 4</td> </tr> <tr> <td>Shrinivas</td> <td>G</td> <td>Mercara</td> <td>08 96 5 445 45 4</td> </tr> </table> </body> </html>

S e t 13

//1. W r i t e C P r o g r a m t o c r e a t e I n di a n F l a g. #include<stdio.h> #include<conio.h> #include<math.h> #include<graphics.h> const float PI=3 .1415 4; void main() { int gdriver=DETECT,gmode=0; int I; Int x,y; initgraph(&gdriver,&gmode,"c:\\tc\\bgi"); cleardevice(); rectangle(0,0,6 3 9,479); outtextxy(25 0,20,"INDIAN FLAG"); rectangle(8 0,5 0,5 6 0,3 8 0); line(8 0,16 0,5 6 0,16 0); line(8 0,270,5 6 0,270); setfillstyle(SOLID_FILL,LIGHTRED); floodfill(8 5 ,6 0,getmaxcolor()); setfillstyle(SOLID_FILL,WHITE); floodfill(8 5 ,170,getmaxcolor()); setfillstyle(SOLID_FILL,GREEN); floodfill(8 5 ,28 0,getmaxcolor()); setcolor(BLUE); circle(3 20,215 ,5 0); for(I=0;I<=3 6 0;I+=15 ) { x=5 0*cos(I*PI/18 0); y=5 0*sin(I*PI/18 0); line(3 20,215 ,3 20+x,215 -y); } setcolor(CYAN); settextstyle(TRIPLEX_FONT,HORIZ_DIR,6 );

outtextxy(200,400," getch(); }

JAI HIND!!!" ) ;

//2. W r i t e C P r o g r a m t o c r e a t e F I S H s t r u c t u r e u s i n g b a s ic geo m e t r i c F u n c t i o n s. #include<graphics.h> #include<stdlib.h> #include<conio.h> #include<dos.h> void main() { int gd=DETECT,gm,i,j,p,q,x,y,k,flag; struct arccoordstype arcinfo; initgraph(&gd,&gm,"c:\\tc\\bgi"); y=getmaxy()/2; i=0; p=0; q=0; j=0; flag=0; setcolor(WHITE); for(k=0;k<5 00;k++) putpixel(random(6 20),random(419),15 ); while(!kbhit()) { line(0+i,y+20,0+i,y-20); /*triangle*/ line(0+i,y+20,20+i,y); line(0+i,y-20,20+i,y); ellipse(8 0+i,y,10-p,3 5 0+p,6 0,25 ); line(140+i,y+3 ,13 0+i,y+8 ); line(13 0+i,y+8 ,140+i,y-5 );

if(flag==0) p=p+2; if(flag==1) p=p-2; circle(120+i,y-6 ,5 ); line(6 0+i,y-25 ,3 0+i,y-45 +j); line(3 0+i,y-45 +j,100+i,y-25 ); line(6 0+i,y+25 ,3 0+i,y+45 +q); line(3 0+i,y+45 +q,100+i,y+25 ); i=i+3 ; if(i>=6 3 8 ) i=0; if(flag==0) j=j-2,q=q+2; if(flag==1) j=j+2,q=q-2; if(j<=-10) flag=1; else if(j>=0) flag=0; delay(10); cleardevice(); } getch(); closegraph(); }

S e t 14

//1. W r i t e O p e n G L P r o g r a m t o c r e a t e a W i n d o w a n d d i s p l a y H E L L O i n s i d e. #include<GL/glut.h> void display(void) { glClear(GL_COLOR_BUFFER_BIT); glColor3 f(1.0,1.0,1.0); glBegin(GL_POLYGON); glVertex3 f(0.25 ,0.25 ,0.25 ); glVertex3 f(0.75 ,0.25 ,0.0); glVertex3 f(0.75 ,0.75 ,0.0); glVertex3 f(0.25 ,0.75 ,0.0); glEnd(); glFlush(); } Void init(void) { glClearColor(0.0,0.0,0.0,0.0); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0.0,1.0,0.0,1.0,-1.0,1.0); } Int main(int argc,char**argv) { glutInit(&argc,argv); glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB); glutInitWindowSize(25 0,25 0); glutInitWindowPosition(100,100); glutCreateWindow(HELLO); init(); glutDisplayFunc(display); glutMainLoop();

return 0; } //2. C r e a t e a s i m p l e s t a t i c w e b p a ge f o r a college ( a s s u m e n ece s s a r y infor m a tion ) <html> <head> <title>My College Site</title> </head> <body bgcolor="gray" text="white" > <div id="banner" style="width:8 00px; height:120px; background-color:black"> <img src="file:///C:/banner.gif" width=8 00 height=120></div> <div id="header" style="position:absolute; left:100px; top:3 0px; width:3 5 0px; height:75 px"> <div><h1><font color="red" face="Monotype corsiva">My College Site</font></h1></div> </div> <div id="header" style="position:absolute; background-color:black; top:13 5 px; width:200px; height:5 00px"> <ul id="listitem" type="circle"> <li><a href=abc.html target="_self">Home</a></li> <li><a href="Sitemap.html">Sitemap<a></li> <li><a href="About.html">About Us<a></li> </ul> </div> <div id="header" style="position:absolute; background-color:black; left:215 px; top:13 5 px; width:5 90px; height:5 00px"> <h3 ><font color="red">Online Admission</font></h3 > <form id="frm1"> Enter your name: <input type="text" id="text1" /> <br/><br/> Gender: <input type="radio" id="gender1" name="gend" />Male <input type="radio" id="gender1" name="gend" />Female <br/><br/> Qualification: Matric<input type="checkbox" id="check1" /> Enter<input type="checkbox" id="check1" /><br/><br/> <input type="reset" value="Reset" /> <input type="submit" value="Submit" post="" /><br/><br/>

</form> </div> </body> </html>

Anda mungkin juga menyukai