Java program for Uniform Resource Locator (URL)

Friday, April 30th, 2010  »  Posted By  »  Total 0 Comment

Program : Uniform Resource Locator (URL) By : Kapil Lohia import java.net.*; import java.io.*;   class url { public static void main(String args[]) throws Exception { URL n1 = new URL("http://java.sun.com:80/docs/index#down"); System.out.println("Protocol:"+n1.getProtocol()); System.out.println("Host :"+n1.getHost()); System.out.println("File Name :"+n1.getFile()); System.out.println("Port :"+n1.getPort()); System.out.println("Reference :"+n1.getRef()); } }

C program to implement tower of Hanoi problem

Sunday, April 4th, 2010  »  Posted By  »  Total 6 Comments

To implement tower of Hanoi problem. #include<stdio.h> void hanoi_tower(char,char,char,int); void hanoi_tower(char peg1,char peg2,char pege3,int n) { if(n<=0) printf("\n Illegal Entry"); if(n==1) printf ("\n Move disk from %c to %c", pege1,pege3); else { hanoi_tower(peg1,peg3,peg2,n-1); hanoi_tower(peg1,peg2,peg3,1); hanoi_tower(peg2,peg1,peg3,n-1); } } Void main () { int n; printf("\n Input the number of dise:); scanf("%d", &n); printf("\n Tower of Hanoi [...]

Java program to implement a shape selector from a given set of shapes

Sunday, April 4th, 2010  »  Posted By  »  Total 2 Comments

To implement a shape selector from a given set of shapes import java.awt.*; import java.awt.event.*; import java.applet.*;   public class shape extend Applet implements itemListener { Chekbox reet,circle,line; ChekboxGroup cbg;   String msg; String s1="reet"; String s2="circle"; string s3="line"; publice void init() { cbg=new checkboxGroup();   rect = new checkbox("reet,cbg,tru); circle = new Checkbox("circle",cbg.false); line [...]

Java program to implement a Color Section from a given set of Color.

Sunday, April 4th, 2010  »  Posted By  »  Total 4 Comments

To implement a Color Section from a given set of Color. import java.awt*; import java.awt.event.*; import java.applet.*;   public class fillcolor extends Applet implement Item Listener { checkbox red,yellow,black,blue.orange; CheckboxGroup cbg; String msg; String s1="red"; String s2="yellow"; String s3="black"; String s4="orange"; public void init() { cbg = new CheckboxGroup(); red = new Chechbox("red",cbg,true); yellow= new [...]

C program for sorting a Linked List

Sunday, April 4th, 2010  »  Posted By  »  Total 1 Comment

C program for sorting a Linked List. #include<stdio.h> #include<dirent.h> #include<malloc.h> #include<string.h>   void main (int argc,char * argv[]) { DIR * directory_pointer; struct dirent* entry; struct File list { char filename[64]; struct File * new; } start,*node,* previous, * new; if((directory_pointer=opendir(argv[1]))==NULL) printf("Error opening %s\n", argv[1]); else { start.next + NULL; while (entry = readdir (directory_pointer)) [...]

C program to Implement Morse code to text conversion and vice-versa.

Sunday, April 4th, 2010  »  Posted By  »  Total 1 Comment

C program to Implement Morse code to text conversion and vice-versa. #include<stdio.h> #include<conio.h> #include<string.h> #include<process.h>   void main() { char str[25],str1[100]; clrscr(); fflush(stdin); printf("enter the String"); gets(str);   int j=0; for(int i=0;i<=strlen(str);++) { switch(toupper(str[i])) { case ‘A’: str1[j++]=’.'; str1[j]=’.'; break;   case ‘b’: str1[j++]=’.'; str1[j++]=’.'; str1[j++]=’.'; str1[j]=’.'; break;   case ‘c’: str1[j++]=’.'; str1[j++]=’.'; str1[j++]=’.'; str1[j]=’.'; [...]

C++ program using class to generate mark sheet using multiple inheritance

Sunday, April 4th, 2010  »  Posted By  »  Total 11 Comments

Using multiple inheritances, prepare a Student Mark sheet, class marks for every student in three subjects. The inherited class generates mark sheet. #include<iostream.h> #include<stdio.h> #include<dos.h> class student { int roll; char name[25]; char add [25]; char *city; public: student() { cout<<"welcome in the student information system"<<endl; } void getdata() { cout<<"\n enter the student roll [...]

C++ class program to perform complex arithmetic using operator overloading

Sunday, April 4th, 2010  »  Posted By  »  Total 1 Comment

Write a program to perform complex arithmetic using operator overloading #include<iostream.h> #include<stdio.h> #include<conio.h> #include<process.h> class complex { int real; float image; public: void getdata() { cout<<"\n enter the real part of the complex"; cin>>real; cout<<"\n enter the imaginary part of the complex"; cin>>image; } void operator + (complex); void operator – (complex); };   void [...]

C++ class program to perform rational number arithmetic

Sunday, April 4th, 2010  »  Posted By  »  Total 1 Comment

Write a program to perform rational number arithmetic. #include<stdio.h> #include<iostream.h> #include<conio.h> class rational { int numer; int denom; public: void getdata() { cout<<"\n enter the numerator part of the rational no."; cin>>numer; cout<<"\n enter the denominator part of the rational no."; cin>>denom; } void operator+(rational); void operator-(rational); void operator *(rational); void operator /(rational); }; void [...]

C++ program using class to multiply by 10 to every member of a list

Sunday, April 4th, 2010  »  Posted By  »  Total 1 Comment

Write a program using class which reads a list of N number of integer type in an array. It modifies the list by multiplying 10 to every number of the list. The modified list is displayed. #include<iostream.h> #include<conio.h> class array { public: void readarray(); void multiply(); }; void array::readarray() { int a[10]; cout<<"Enter the elements [...]

Question and Answer
C/C++ Unix & Linux Wordpress
Source codes
C C++ Java

Free email signup