*
//BIODATA
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.lang.*;
/*
<applet code="bio" width =1000
height =700>
</applet > */
public class bio extends Applet implements
ActionListener,ItemListener
{
int
i;
int
day[]={0,31,28,31,30,31,30,31,31,30,31,30};
Label l1,l2,l3,l4,l5,l6,l7,l8,l9;
TextField t1,t2;
Choice c1,c2,c3,c4;
Checkbox ck1,ck2,ck3;
CheckboxGroup cbg,cgg;
TextArea tt1,res;
List list1;
Button b1,b2;
public void init()
{
setBackground(Color.green);
l1=new Label("NAME :",Label.LEFT);
l2=new Label("AGE :",Label.LEFT);
l3=new Label("DOB :",Label.LEFT);
l4=new Label("GENDER
:",Label.LEFT);
l5=new Label("MAIL
ID:",Label.LEFT);
l6=new
Label("ADDRESS:",Label.LEFT);
l7=new Label("HOBBIES:",Label.LEFT);
l8=new
Label("RESULT:",Label.LEFT);
l9=new Label("APPLET PROGRAM FOR
BIO-DATA",Label.CENTER);
t1=new TextField();
t2=new TextField();
c1=new Choice();
c1.addItem("LESS THAN 0 ");
c1.addItem("BETWEEN 0 & 25
");
c1.addItem("BETWEEN 25& 40
");
c1.addItem("GRAETER THAN 45 ");
c2=new Choice();
c3=new Choice();
c4=new Choice();
cbg=new CheckboxGroup();
cgg=new CheckboxGroup();
ck1=new
Checkbox("MALE",false,cgg);
ck2=new
Checkbox("FEMALE",false,cgg);
tt1=new TextArea();
res=new TextArea();
list1=new List(3,true);
b1=new Button("OK");
b2=new Button("CANCEL");
setLayout(null);
for(i=1970;i<=2010;i++)
c2.addItem(String.valueOf(i));
for(i=1;i<=12;i++)
c3.addItem(String.valueOf(i));
for(i=1;i<=31;i++)
c4.addItem(String.valueOf(i));
list1.addItem("Reading ,");
list1.addItem("Music, ");
list1.addItem("Horse Riding, ");
list1.addItem("Gardening, ");
l1.setBounds(100,50,75,25);
l3.setBounds(100,130,75,25);
l9.setBounds(400,0,300,100);
l2.setBounds(100,90,75,25);
t1.setBounds(185,50,150,25);
c1.setBounds(185,100,150,25);
c2.setBounds(185,130,60,50);
c3.setBounds(245,130,38,35);
c4.setBounds(275,130,60,30);
l4.setBounds(100,170,75,25);
ck1.setBounds(185,170,50,25);
ck2.setBounds(295,170,70,25);
l5.setBounds(100,210,80,25);
tt1.setBounds(185,250,150,80);
l6.setBounds(100,250,150,25);
l8.setBounds(500,250,50,25);
t2.setBounds(185,210,150,25);
l7.setBounds(100,360,55,25);
list1.setBounds(185,360,150,100);
b1.setBounds(125,495,75,25);
b2.setBounds(210,495,75,25);
res.setBounds(580,250,200,150);
add(l1);
add(t1);
add(l2);
add(c1);
add(l3);
add(c2);
add(c3);
add(c4);
add(l4);
add(ck1);
add(ck2);
add(l5);
add(tt1);
add(l6);
add(t2);
add(l7);
add(l8);
add(list1);
add(b1);
add(b2);
add(l9);
add(res);
b1.addActionListener(this);
c2.addItemListener(this);
c3.addItemListener(this);
b2.addActionListener(this);
}
public void actionPerformed(ActionEvent ac)
{
res.setText(" ");
if(ac.getActionCommand().equals("OK"))
{
Checkbox z=cgg.getSelectedCheckbox();
String gender=z.getLabel();
res.append("NAME
:"+t1.getText()+"\n");
res.append("AGE
:"+c1.getSelectedItem()+"\n");
res.append("DOB
:"+c4.getSelectedItem()+"-"+c3.getSelectedItem()+"-"+c2.getSelectedItem()+"\n");
res.append("GENDER :"+gender+"\n");
res.append("ADDRESS:"+tt1.getText()+"\n");
res.append("MAIL ID:"+t2.getText()+"\n");
String jj[]=list1.getSelectedItems();
String mm="";
for(i=0;i<jj.length;i++)
mm+=jj[i];
res.append("HOBBIES:"+mm);
}
if(ac.getActionCommand().equals("CANCEL"))
{
t1.setText("");
tt1.setText("");
t2.setText("");
}
}
public void itemStateChanged(ItemEvent ie)
{
int
j=Integer.parseInt(c2.getSelectedItem());
int
k=Integer.parseInt(c3.getSelectedItem());
c4.removeAll();
for(i=0;i<day[k];i++)
c4.addItem(String.valueOf(i));
}
}
**
//COLOR
PALATE
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.lang.*;
/*
<applet code="color" width =1000
height =700>
</applet > */
public class color extends Applet
implements ActionListener
{
Label l1,l2;
TextArea
t;
Button[] b=new Button[11];
CheckboxGroup cg=new CheckboxGroup();
public void init()
{
String v,v1="Try & Try Until The Goal is Reached";
//System.out.println("enter the Some Words");
t=new TextArea(v1);
add(t);
l1=new Label("Color Palatte");
add(l1);
l2=new Label("List Of Colors");
add(l2);
b[0]=new Button("white");
b[1]=new Button("black");
b[2]=new Button("green");
b[3]=new Button("blue");
b[4]=new Button("yellow");
b[5]=new Button("red");
Checkbox c1=new Checkbox("Foreground",true,cg);
Checkbox c2=new Checkbox("Background",false,cg);
setLayout(null);
l1.setLocation(800,10);
l1.setSize(100,20);
l2.setLocation(10,10);
l2.setSize(100,20);
b[0].setLocation(50,50);
b[0].setSize(100,20);
b[1].setLocation(150,50);
b[1].setSize(100,20);
b[2].setLocation(50,100);
b[2].setSize(100,20);
b[3].setLocation(150,100);
b[3].setSize(100,20);
b[4].setLocation(50,150);
b[4].setSize(100,20);
b[5].setLocation(150,150);
b[5].setSize(100,20);
c1.setLocation(50,200);
c1.setSize(100,20);
c2.setLocation(150,200);
c2.setSize(100,20);
t.setLocation(333,300);
t.setSize(100,20);
t.setBounds(400,200,200,40);
for(int i=0;i<=5;i++)
{
add(b[i]);
b[i].addActionListener(this);
}
add(c1);
add(c2);
}
public void actionPerformed(ActionEvent a)
{
String v=a.getActionCommand();
Checkbox c=cg.getSelectedCheckbox();
String ch=c.getLabel();
if(ch=="Background")
{
if(v=="blue") t.setBackground(new Color (0,0,255));
else if(v=="yellow") t.setBackground(new Color (255,255,0));
else if(v=="green") t.setBackground(new Color (0,255,0));
else if(v=="red") t.setBackground(new Color (255,0,255));
else if(v=="white") t.setBackground(new Color (255,255,255));
else t.setBackground(new Color (0,0,0));
}
else
{
if(v=="blue") t.setForeground(new Color (0,0,255));
else if(v=="yellow") t.setForeground(new Color (255,255,0));
else if(v=="green") t.setForeground(new Color (0,255,0));
else if(v=="red") t.setForeground(new Color (255,0,255));
else if(v=="white") t.setForeground(new Color (255,255,255));
else t.setForeground(new Color (0,0,0));
}
}
}
***
// CALCULATOR
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
/* <applet code="calc"
width=400 height=400>
</applet> */
public class calc extends Applet implements
ActionListener
{
int a,b,d,ch;
String s="",opr;
double res,ip;
TextField t;
public void init()
{
setLayout(new BorderLayout());
Panel p=new Panel();
t=new TextField(10);
add(t);
add("North",t);
t.setText("");
p.setLayout(new
GridLayout(6,2));
Button b1=new
Button("1");
Button b2=new
Button("2");
Button b3=new
Button("3");
Button b4=new
Button("4");
Button b5=new
Button("5");
Button b6=new
Button("6");
Button b7=new
Button("7");
Button b8=new
Button("8");
Button b9=new
Button("9");
Button b10=new
Button("0");
Button b11=new
Button("+");
Button b12=new
Button("-");
Button b13=new
Button("*");
Button b14=new
Button("/");
Button b15=new
Button("=");
Button b16=new
Button(".");
Button b17=new
Button("CE");
Button b18=new
Button("OFF");
p.add(b1);
p.add(b2);
p.add(b3);
p.add(b4);
p.add(b5);
p.add(b6);
p.add(b7);
p.add(b8);
p.add(b9);
p.add(b10);
p.add(b11);
p.add(b12);
p.add(b13);
p.add(b14);
p.add(b15);
p.add(b16);
p.add(b17);
p.add(b18);
add(p,BorderLayout.CENTER);
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
b4.addActionListener(this);
b5.addActionListener(this);
b6.addActionListener(this);
b7.addActionListener(this);
b8.addActionListener(this);
b9.addActionListener(this);
b10.addActionListener(this);
b11.addActionListener(this);
b12.addActionListener(this);
b13.addActionListener(this);
b14.addActionListener(this);
b15.addActionListener(this);
b16.addActionListener(this);
b17.addActionListener(this);
b18.addActionListener(this);
}
public void actionPerformed(ActionEvent ae)
{
String c;
String
str=ae.getActionCommand();
if(str.equals("+")||str.equals("*")||str.equals("-")||str.equals("/"))
{
s=t.getText();
t.setText("");
opr=str;
ip=Double.parseDouble(s);
}
else if(str.equals("CE"))
t.setText("0");
else
if(str.equals("OFF"))
t.setText("");
else
if(str.equals("="))
{
if(opr.equals("+"))
res=ip+Double.parseDouble(t.getText());
else
if(opr.equals("-"))
res=ip-Double.parseDouble(t.getText());
else
if(opr.equals("*"))
res=ip*Double.parseDouble(t.getText());
else
if(opr.equals("/"))
res=ip/Double.parseDouble(t.getText());
s=String.valueOf(res);
t.setText(s);
ch=0;
}
else
t.setText(t.getText()+str);
}
public Insets getInsets()
{
return new
Insets(100,100,100,100);
}
}
****
// cascade.html
<html>
<head>
<title> cascadding of style
sheets</title>
</head>
<body bgcolor=green>
<center >
<em> MahaRaja various Institute
</em></center><br>
<ul>
<ol type="i"><li> MAHARAJA ENG COLLEGE
</li>
<ul>
<li>Avinashi</li>
<li>Coimbatore </li>
</ul>
<li> MAHARAJA PRITHVI
ENG COLLEGE
</li>
<ul>
<li>Avinashi</li>
<li>Coimbatore </li>
</ul>
<li> MAharaja Institute of tech
</li>
<ul>
<li> NeelemBur</li>
</ul></ol>
<br>
<a href="main.html"> Back
</a>
</body>
</html>
// main.html
<html>
<head>
<title> type of
styleshhets</title>
</head>
<body bgcolor=shyblue>
<center ><h1> various style
sheets </h1></center>
<br>
<br>
<a href
="F:\praba0107\ip\2cascading\cascade.html"> CASCADDING STYLE
SHEET</a>
<br>
<a href
="F:\praba0107\ip\2cascading\link.html"> External Link</a>
<br>
<a href
="F:\praba0107\ip\2cascading\embed.html"> Embedded STYLE SHEET</a>
<br>
<a href
="F:\praba0107\ip\2cascading\inline.html"> InLine STYLE
SHEET</a>
<br>
</body>
</html>
//embedded.html
<html>
<head>
<title>embedded</title>
<head>
<body>
<h1>External links</h1>
</body>
</html>
// mapping
<html>
<body>
<title> india map</title>
<body bgcolor="rgb(13:29 PM
6/14/20160,60,86)">
<img border="1" src
="F:praba0107\ip\1mapping\india_map.gif" usemap="#map" align
="center" alt="circle">
<map name="map">
<marquee>INDIA MAP</marquee>
<area shape ="circle" coords
="210,640,25" href ="F:\kris0107\tn.html">
<area shape ="circle" coords
="350,380,25" href ="F:\kris0107\kol.html">
<area shape ="circle" coords
="200,100,50" href ="F:\kris0107\j&k.html">
<area shape ="circle" coords
="150,150,25" href ="F:\kris0107\pun.html">
</body>
</html>
//tamilnadu.html
<html>
<head>
<title></title>
<body style text="red">
<h1 align ="center" >
<marquee>Welcome to TamilNadu
</marquee>
</h1>
</body>
</head>
</html>
*
// CHAT
CLIENT
import java.net.*;
import java.io.*;
public class chatclient
{
public static void main(String args[])throws
IOException
{
try
{
DatagramSocket s=new DatagramSocket();
InetAddress add= InetAddress.getLocalHost();
byte outbuffer[]=new byte[1024];
byte inbuffer[]=new byte[1024];
String data,x,str;
DataInputStream in =new DataInputStream(System.in);
System.out.println("Client window");
do
{
DatagramPacket indata=new DatagramPacket(inbuffer,inbuffer.length);
System.out.println("to server");
str=in.readLine();
outbuffer=str.getBytes();
DatagramPacket outdata=new
DatagramPacket(outbuffer,outbuffer.length,add,2000);
s.send(outdata);
s.receive(indata);
data=new String(indata.getData()).trim();
System.out.println("From Server:"+data);
}
while(!((data.equals("stop")||str.equals("stop"))));
}
catch(IOException e)
{
System.out.println(e);
}
}
}
//CHAT
SERVER
import java.net.*;
import java.io.*;
public class chatserver
{
public static void main(String as[])throws
IOException
{
try
{
DatagramSocket s=new DatagramSocket(2000);
byte outbuffer[]=new byte[1024];
byte inbuffer[]=new byte[1024];
String data,x,str;
DataInputStream in =new DataInputStream(System.in);
System.out.println("Server window");
do
{
x=" ";
DatagramPacket indata=new DatagramPacket(inbuffer,inbuffer.length);
s.receive(indata);
InetAddress add=indata.getAddress();
int port=indata.getPort();
data=new String(indata.getData()).trim();
System.out.println("From Client:"+data);
System.out.println("To client ");
str=in.readLine();
outbuffer=str.getBytes();
DatagramPacket outdata=new
DatagramPacket(outbuffer,outbuffer.length,add,port);
s.send(outdata);
}
while(!((data.equals("stop")||(str.equals("stop")))));
}
catch(IOException e)
{
System.out.println(e);
}
}
}
**
//ONLINE
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
public class online extends HttpServlet
{
public
void doPost(HttpServletRequest req,HttpServletResponse res)throws
ServletException,IOException
{
try
{
String
num="";
int
m,f=0;
String
name=req.getParameter("sname");
String
rno=req.getParameter("regno");
String
ans1=req.getParameter("b");
if(ans1.equals("Byte"))
{
m=2;}
else {m=0;}
String
ans2=req.getParameter("co");
if(ans2.equals("core"))
{
m+=2;}
else {m+=0;}
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection
c=DriverManager.getConnection("jdbc:odbc:std");
Statement
s=c.createStatement();
ResultSet
r=s.executeQuery("select *from std");
while(r.next())
{
num=r.getString(2);
if(rno.equalsIgnoreCase(num))
f=1;
}
PrintWriter
p=res.getWriter();
if(f==0)
{
s.executeUpdate("insert
into std
values('"+name+"','"+rno+"',"+m+")");
res.setContentType("text/html");
p.println("Inserted");
}
else
p.println("The
number is already present");
p.close();
}
catch(Exception
e)
{
System.out.println(e.getMessage());
}
}
}
//
SOURCE CODE FOR ONLINE WEBPAGE
<html>
<body>
<form name="form1"
method="post"
action="http:\\localhost\servlets-examples\servlet\online">
<b><center>ONLINE
EXAMINATIONS</center></b>
<br> <b>Student
Name     </b>
<input type= textbox
name="sname" value=" ">
<br> <br>
<b> Register Number</b>
<input type= textbox
name="regno" value=" ">
<br> <br>
1.How the memory is termed?<br>
<input type= "radio"
name="b" value="Byte"> <b>Byte</b>
<br> <br>
<input type= "radio"
name="b" value="KiloByte"> <b>Kilobyte</b>
<br> <br>
<input type= "radio"
name="b" value="MegaByte"> <b>Megabyte</b>
<br> <br>
<input type= "radio"
name="b" value="GigaByte"> <b>Gigabyte</b>
<br> <br>
2.Which is the first processor developed in
India ?
<br><br>
<input type= "radio"
name="co" value="core"><b>core</b>
<br> <br>
<input type= "radio"
name="co" value="intel"> <b>intel</b>
<br> <br>
<input type= "radio"
name="co" value="centrino"> <b>centrino</b>
<br> <br>
<input type= "radio"
name="co" value="2duo"> <b>2duo</b>
<br> <br>
<center> <input type=submit
value="submit"></center>
</form>
</body>
</html>
***
// BANK
import java.io.*;
import java.lang.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class Bank extends HttpServlet
{
public
void doPost(HttpServletRequest req,HttpServletResponse res)throws
ServletException,IOException
{
int
bal=0;
PrintWriter
pw=res.getWriter();
pw.println("       
BANK TRANSACTION <br>");
pw.println("       
~~~~ ~~~~~~~~~~~ <br>");
pw.println("Name :");
String
custname =req.getParameter("name");
pw.println(custname);
pw.println("<br>");
pw.println("Account
Number:");
String
accno=req.getParameter("id");
pw.println(accno);
pw.println("<br>");
pw.println("Amount :");
String
deposit=req.getParameter("dep");
int
dep=Integer.parseInt(deposit);
bal=
bal+dep;
String
withdraw =req.getParameter("withd");
int
withd=Integer.parseInt(withdraw);
if(withd>bal)
pw.println("You
Cannot Withdraw");
else
bal=bal-withd;
pw.println(bal);
pw.close();
}
}
**
// SOURCE
CODE FOR BANK WEBPAGE
<html>
<body bgcolor="meganta">
<form name="form1"
method="post" action="http:\\localhost\servlets-examples\servlet\Bank">
<b><center>Bank
Transaction</center></b><br><br>
<b>Name  </b>
<input type=textbox
name="name" value=""><br><br>
<b>ID    </b>
<input type=textbox name="id"
value=""><br><br>
<b>DEPOSIT</b>
<input type=textbox name="dep"
value="0"><br><br>
<b>WITHDRAW</b>
<input type=textbox
name="withd" value="0"><br><br>
<center><input type=submit
value="submit"></center>
</form>
</body>
</html>
//filetransfer bone
import java.io.*;
import java.net.*;
class Bone
{
public static void main(String args[])throws
IOException,NullPointerException
{
String filename,out;
ServerSocket s=new ServerSocket(9981);
System.out.println("The Server Running");
while(true)
{
Socket serverc=s.accept();
BufferedReader in=new
BufferedReader(new InputStreamReader(serverc.getInputStream()));
filename=in.readLine();
BufferedReader br=new
BufferedReader(new FileReader(filename));
out=br.readLine();
System.out.println("File
received");
System.out.println("File
Name:"+filename);
System.out.println("The
content");
System.out.println(out);
out=br.readLine();
}
}
// ftp
import java.io.*;
import java.net.*;
import java.lang.*;
class Ftp
{
public static void main(String args[])throws IOException
{
String sent1;
Socket c=new
Socket(InetAddress.getLocalHost(),9981);
BufferedReader in=new
BufferedReader(new InputStreamReader(System.in));
DataOutputStream out=new
DataOutputStream(c.getOutputStream());
System.out.println("\nEnter
the file name:");
sent1=in.readLine();
out.writeBytes(sent1+"\n");
c.close();
}
}
import java.io.*;
import java.net.*;
import java.lang.*;
class uclient
{
public static void main(String args[])throws IOException
{
String sent1;
Socket c=new Socket(InetAddress.getLocalHost(),9981);
BufferedReader in=new
BufferedReader(new InputStreamReader(System.in));
DataOutputStream out=new
DataOutputStream(c.getOutputStream());
System.out.println("\nEnter the file name:");
sent1=in.readLine();
out.writeBytes(sent1+"\n");
c.close();
}
}
//PGM FOR FILE TRANSFER OF SERVER
import java.io.*;
import java.net.*;
class userver
{
public static void main(String args[])throws
IOException,NullPointerException
{
String filename,out;
ServerSocket s=new ServerSocket(9981);
System.out.println("The Server Running");
while(true)
{
Socket serverc=s.accept();
BufferedReader in=new
BufferedReader(new InputStreamReader(serverc.getInputStream()));
filename=in.readLine();
BufferedReader br=new
BufferedReader(new FileReader(filename));
out=br.readLine();
System.out.println("File
received");
System.out.println("File
Name:"+filename);
System.out.println("The
content");
System.out.println(out);
out=br.readLine();
}
}
}
//PGM FOR HOMEPAGE
DOWNLOADING
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import java.net.*;
import java.util.*;
import java.io.*;
public class web
{
public
static void main(String arg[])
{
try
{
URL
u=new URL("http://www.google.com");
URLConnection
uc=u.openConnection();
InputStream
in=u.openStream();
in=new
BufferedInputStream(in);
int
c;
while((c=in.read())!=-1);
{
System.out.println("(char)c");
}
System.out.println("The
protocol is :" + u.getProtocol());
long
d=uc.getDate();
System.out.println("The
date is :" + new
Date(d));
System.out.println("T%he
content type is :" +
uc.getContentType());
d=uc.getExpiration();
System.out.println("The
expiration date is :" + new
Date(d));
d=uc.getLastModified();
System.out.println("The
last modified date is:" + new Date(d)) ;
System.out.println("The
content length is :" +
uc.getContentLength());
System.out.println("The
protocol is :" + u.getProtocol()) ;
System.out.println("The
host name is :" +
u.getHost()) ;
System.out.println("The
port is :" +
u.getPort()) ;
System.out.println("The
user information :" +
u.getUserInfo()) ;
System.out.println("The
Authority :" + u.getAuthority()) ;
System.out.println("The
reference is :" + u.getRef()) ;
System.out.println("The
Query is :" + u.getQuery()) ;
}
catch(MalformedURLException
e)
{
System.out.println(e);
}
catch(IOException
e)
{
System.out.println(e);
}
}
}
//pgm for snake game coding
#include<conio.h>
#include<stdlib.h>
#include<ctype.h>
#include<stdio.h>
#include<graphics.h>
#include<dos.h>
void
main()
{
int
gd=0,gm,i=110,j=110,score=0,p1=150,p2=150;
char
a;
initgraph(&gd,&gm,"c:\\tcc\\bgi");
int
x1=100,x2=100,x3=500,x4=400;
rectangle(x1,x2,x3,x4);
int
counter=0;
while(1)
{
a=getch();
a=toascii(a);
char
ff[12];
outtextxy(p1,p2,"-");
//printf("%d
%d",i,j);
switch(a)
{
case
54:
{ clearviewport();
rectangle(x1,x2,x3,x4);
i+=5;
outtextxy(i,j,"--");
if((i==p1)&&(j==p2))
{
// for(int i=0;i<10;i++)
//
delay(i);
//blink(//);
//delay(3000);//counter++;
//if(counter==2)
counter++;
if(counter==5)
outtextxy(p1+100,p2+100,"*");
sound(15);
score=score+5;
// printf("YOUR
SCORE IS %d",score);
p1=250;
p2=300;
}
break;
}
case
50:
{ clearviewport();
rectangle(x1,x2,x3,x4);
j+=5;
outtextxy(i,j,"--");
// outtextxy(p1+100,p2+50,"*");
if((i==p1)&&(j==p2))
{
sound(15);
score=score+5;
//printf("YOUR
SCORE IS %d",score);
p1=420;
p2=250;
}break;
}
case
52:
{ clearviewport();
rectangle(x1,x2,x3,x4);
i-=5;
// outtextxy(p1+100,p2+50,"*");
outtextxy(i,j,"--");
if((i==p1)&&(j==p2))
{ sound(15);
score=score+5;
// printf("YOUR
SCORE IS %d",score);
p1=420;
p2=390;
}break;
}
case
56:
{
clearviewport();
rectangle(x1,x2,x3,x4);
j-=5;
outtextxy(i,j,"--");
outtextxy(p1+100,p2+50,"*");
if((i==p1)&&(j==p2))
{ sound(15);
score=score+5;
//printf("YOUR
SCORE IS %d",score);
p1=300;
p2=300;
}break;
}
default:
{
clearviewport();
exit(0);
break;
}
}
printf("YOUR
SCORE IS %d",score);
outtextxy(p1,p2,"-");
getch();
}
}
//pgm for character clipping
coding
#include<iostream.h>
#include<conio.h>
#include<dos.h>
#include<graphics.h>
#include<string.h>
#include<math.h>
int a=180,b=140,c=470,d=340;
void showclippedtext(const int, const int,
const char* string, const int);
int main()
{
int
driver=0;
int
mode=VGAHI;
initgraph(&driver,&mode,"c:\\tcc\\bgi");
setcolor(15);
rectangle(a,b,c,d);
setcolor(7);
settextstyle(0,0,2);
outtextxy(160,160,"STRING
1");
outtextxy(250,300,"STRING
2");
settextstyle(0,1,2);
outtextxy(400,100,"STRING
3");
outtextxy(440,180,"STRING
4");
setcolor(5);
// outtextxy(163,450,"PRESS
'C' TO SEE THE CLIPPED TEXT");
setcolor(15);
setcolor(12);
// outtextxy(213,450,"PRESS
ANY KEY TO EXIT");
setcolor(10);
settextstyle(0,0,2);
showclippedtext(160,160,"STRING
1",0);
showclippedtext(250,300,"STRING
2",0);
settextstyle(0,1,2);
showclippedtext(400,100,"STRING
3",1);
showclippedtext(440,180,"STRING
4",1);
getch();
return
0;
}
void showclippedtext(const int _x, const
int _y, const char* string, const int text_direction)
{
int
x=_x;
int
y=_y;
int
width;
int
height;
int
length=strlen(string);
if(text_direction==1)
y+=textwidth(string);
char
character[5]={NULL};
for(int
count=0;count<length;count++)
{
character[0]=string[count];
width=textwidth(character);
height=textheight(character);
if(text_direction==0)
{
if(x>=a&&y>=b&&(x+width)<=c&&(y+height)<=d)
outtextxy(x,y,character);
x+=width;
}
else
if(text_direction==1)
{
y-=width;
if(x>=a&&y>=b&&(x+height)<=c&&(y+width)<=d)
outtextxy(x,y,character);
}
}
}
/*void showclippedtext(const int _x, const
int _y, const char* string, const int text_direction)
{
int
x=_x;
int
y=_y;
int
width;
int
height;
int
length=strlen(string);
if(text_direction==1)
y+=textwidth(string);
char
character[5]={NULL};
for(int
count=0;count<length;count++)
{
character[0]=string[count];
width=textwidth(character);
height=textheight(character);
if(text_direction==0)
{
if(x>=a&&y>=b&&(x+width)<=c&&(y+height)<=d)
outtextxy(x,y,character);
x+=width;
}
else
if(text_direction==1)
{
y-=width;
if(x>=a&&y>=b&&(x+height)<=c&&(y+width)<=d)
outtextxy(x,y,character);
}
}
}*/
//pgm for folder creation
#include <stdio.h>
#include<dir.h>
#include<conio.h>
void main(void)
{
clrscr();
char
*a;
for( *a=1;*a<=100;*a++)
{
char
*b;
*b=*a;
mkdir(b);
printf("%d
",b);
}
getch();
}
//pgm for integer n float
comparision
#include<conio.h>
#include<stdlib.h>
#include<ctype.h>
#include<stdio.h>
#include<graphics.h>
#include<dos.h>
void
main()
{
// int
gd=0,gm,i=110,j=110,score=0,p1=150,p2=50;
char
a;
a=getch();
a=toascii(a);
printf("krishnan
");
printf("%d",a);
getch();
}
hi
ReplyDelete