Friday, July 6, 2012

75. HTTP SERVER IN JAVA


// HTTP SERVER
import java.io.*;
import java.net.*;
import java.util.*;
import java.lang.*;


public class HttpServer
{
     public static void main(String [] args)
     {
          int i=1;
System.out.println("********************************************************************************");
System.out.println("******************************  HTTP 
SERVER***********************************");
System.out.println("********************************************************************************");
          System.out.println("Server Started...");
          System.out.println("Waiting for connections...");
          try
          {

74. CLIENT SERVER MULTICASTING


//SERVER SIDE
import java.io.*;
import java.net.*;
import java.util.Vector;
import java.util.Enumeration;
public class chatkaro12mServer
{
//static String k=socket.getInetAddress().getHostName();
private int port=5001;
private boolean li=true;
private Vector clients=new Vector();
public static void main(String a[])
{
System.out.println(" Press ctrl-c to Quit.");
new chatkaro12mServer().server();
}

73. CLCHAT IN JAVA


//CLIENT SIDE 
import java.net.*;
import java.io.*;
public class CLChatClient {


   static final int DEFAULT_PORT = 1728;  // Port where server is
                                          // listening, if no
                                          // port is specified
                                          // on the command line.
                                         
   static final String HANDSHAKE = "CLChat";  // Handshake string.
                   // Each end of the connection sends this string
                   // to the other just after the connection is 
                   // opened.  This is done to confirm that the
                   // program on the other side of the connection 
                   // is a CLChat program.   

Wednesday, July 4, 2012

72. FRACTAL EXPLORER IN JAVA




import java.awt.*;
import java.applet.*;
import java.awt.image.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.border.*;


public class Fractal extends Applet implements ActionListener, MouseListener, MouseMotionListener, 
AdjustmentListener, KeyListener, DocumentListener {
public static final int X = 800, Y = 550, ButX=72, ButY=26;
public static final int Min_Iter=0, Max_Iter=10000, SL_phMAX=200, SL_peMAX=400, Max_Fractal=6;
public static final double STX[]={ -2.7, -2.3, -2.5, -2.2, -5.2, 2.98 };

71. SUM OF SUBSETS PROBLEM


//SUM OF SUBSETS PROBLEM
import java.io.*;
import java.util.*;
public class SumOfSubsets
{
static int [] w;
static int [] x;
public static BufferedReader br =new BufferedReader(new InputStreamReader(System.in));
public static void SumOfSubsets(int s, int k, int r, int m)
{
int i;
x[k]=1;
if((s+w[k])==m)
{
System.out.print("{");
for(i=1;i<=k;i++) System.out.print(x[i]+" ");

70. HAMILTONIAN CYCLE PROBLEM


//HAMILTONIAN CYCLE PROBLEM
import java.io.*;
public class Hamiltonian
{
static int [][] G;
static int [] x;
static int n;
static boolean found = false;
public static BufferedReader br =new BufferedReader(new InputStreamReader(System.in));
public static void main(String[] args) throws IOException
{
System.out.println("\t\t\t\tHamiltonian Cycle");
System.out.print("\nEnter the number of the vertices: ");
n = Integer.parseInt(br.readLine());
G = new int[n+1][n+1];
x = new int[n+1];

69. GRAPH COLORING PROBLEM


//GRAPH COLORING PROBLEM
import java.io.*;
public class GraphColoring
{
static int [][] G;
static int [] x;
static int n, m;
static boolean found = false;
public static BufferedReader br =new BufferedReader(new InputStreamReader(System.in));
public static void main(String[] args) throws IOException
{
System.out.println("\t\t\t\tGRAPH COLORING");
System.out.print("\nEnter the number of the vertices: ");
n = Integer.parseInt(br.readLine());
G = new int[n+1][n+1];
x = new int[n+1];

Tuesday, July 3, 2012

68. MIDPOINT SUBDIVISION LINE CLIPPING


//MIDPOINT SUBDIVISION LINE CLIPPING 
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<dos.h>
#include<math.h>
#include<graphics.h>
typedef struct coordinate
{
int x,y;
char code[4];
}PT;
void drawwindow();
void drawline (PT p1,PT p2,int cl);
PT setcode(PT p);

Sunday, July 1, 2012

67. THICK LINE DRAWING



//THICK LINE DRAWING
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<math.h>
void main()
{
int gd = DETECT, gm  ;
float wy, wx, x1, y1, x2, y2;
int i, thickness;
initgraph(&gd, &gm, "C:\\TC\\BGI");
printf("Enter the co-ordinates for the line:\n");
printf("X1: ");

66. SIERPINSKI TRIANGLE IN C


//SIERPINSKI TRIANGLE IN C
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <math.h>
#include <graphics.h>
void DrawSierpinski(void);
void main(void)
{
int gd=VGA;
int gm=VGAHI;
initgraph(&gd, &gm, "C:\\tc\\bgi");
DrawSierpinski();
getch();
}

65. MANDELBROT SET IN C


#include <stdio.h>
#include <graphics.h>
#include <conio.h>
#include <math.h>
#include <stdlib.h>
#include <alloc.h> 
int MX, MY; 
int MC; /* max color */
void init( void )
{
  int gd = 0, gm = VGALO;
  initgraph( &gd, &gm, "c:\\tc\\bgi");
} 
void initPalette( void )
{ int i;