<?xml version="1.0" encoding="UTF-8" standalone="no"?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:gd="http://schemas.google.com/g/2005" xmlns:georss="http://www.georss.org/georss" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:thr="http://purl.org/syndication/thread/1.0"><id>tag:blogger.com,1999:blog-3930802340726048488</id><updated>2024-10-01T23:31:18.352-07:00</updated><category term="Conceptial programs"/><category term="Data Structures"/><category term="Sample unix programs"/><category term="Unix programming"/><category term="Logical programs"/><title type="text">FREE CODES</title><subtitle type="html">BYTES WITH LOGIC</subtitle><link href="http://123bytes.blogspot.com/feeds/posts/default" rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml"/><link href="http://www.blogger.com/feeds/3930802340726048488/posts/default?redirect=false" rel="self" type="application/atom+xml"/><link href="http://123bytes.blogspot.com/" rel="alternate" type="text/html"/><link href="http://pubsubhubbub.appspot.com/" rel="hub"/><link href="http://www.blogger.com/feeds/3930802340726048488/posts/default?start-index=26&amp;max-results=25&amp;redirect=false" rel="next" type="application/atom+xml"/><author><name>Ganesh</name><uri>http://www.blogger.com/profile/02324863064543496197</uri><email>noreply@blogger.com</email><gd:image height="16" rel="http://schemas.google.com/g/2005#thumbnail" src="https://img1.blogblog.com/img/b16-rounded.gif" width="16"/></author><generator uri="http://www.blogger.com" version="7.00">Blogger</generator><openSearch:totalResults>36</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><xhtml:meta content="noindex" name="robots" xmlns:xhtml="http://www.w3.org/1999/xhtml"/><entry><id>tag:blogger.com,1999:blog-3930802340726048488.post-5841141846825900255</id><published>2010-05-22T12:34:00.000-07:00</published><updated>2010-05-22T12:35:52.690-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Sample unix programs"/><category scheme="http://www.blogger.com/atom/ns#" term="Unix programming"/><title type="text">CREATING CHILD PROCESS USING FORK</title><content type="html">CREATING CHILD PROCESS USING FORK IN UNIX PROGRAMS&lt;br /&gt;&lt;br /&gt;#include&lt;stdio.h&gt;&lt;br /&gt;#include&lt;fcntl.h&gt;&lt;br /&gt;#include&lt;sys/stat.h&gt;&lt;br /&gt;#include&lt;sys/types.h&gt;&lt;br /&gt;#include&lt;string.h&gt;&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;  int pid,m=0;&lt;br /&gt;  pid=fork();&lt;br /&gt;  if(pid==0)&lt;br /&gt;  {&lt;br /&gt;  &lt;br /&gt;   printf("%d\n",m);&lt;br /&gt;   printf("CHILD PROCESS STARTED :");&lt;br /&gt;   printf("The child process ID 1: %d\n",getpid());&lt;br /&gt;   printf("The parent of child  process ID 2: %d \n",getppid());&lt;br /&gt;  }&lt;br /&gt;  else&lt;br /&gt;  {&lt;br /&gt;   sleep(5);&lt;br /&gt;   printf("%d\n",m);&lt;br /&gt;   printf("PARENT PROCESS STARTED :");&lt;br /&gt;   printf("The parent process ID 3:%d \n",getpid());&lt;br /&gt;   printf("The Parent of Parent process ID 4: %d \n",getppid());&lt;br /&gt;  }&lt;br /&gt;}</content><link href="http://123bytes.blogspot.com/feeds/5841141846825900255/comments/default" rel="replies" title="Post Comments" type="application/atom+xml"/><link href="http://www.blogger.com/comment/fullpage/post/3930802340726048488/5841141846825900255" rel="replies" title="0 Comments" type="text/html"/><link href="http://www.blogger.com/feeds/3930802340726048488/posts/default/5841141846825900255" rel="edit" type="application/atom+xml"/><link href="http://www.blogger.com/feeds/3930802340726048488/posts/default/5841141846825900255" rel="self" type="application/atom+xml"/><link href="http://123bytes.blogspot.com/2010/05/creating-child-process-using-fork.html" rel="alternate" title="CREATING CHILD PROCESS USING FORK" type="text/html"/><author><name>Ganesh</name><uri>http://www.blogger.com/profile/02324863064543496197</uri><email>noreply@blogger.com</email><gd:image height="16" rel="http://schemas.google.com/g/2005#thumbnail" src="https://img1.blogblog.com/img/b16-rounded.gif" width="16"/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3930802340726048488.post-9204671789181258335</id><published>2010-05-22T12:32:00.000-07:00</published><updated>2010-05-22T12:34:20.678-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Sample unix programs"/><category scheme="http://www.blogger.com/atom/ns#" term="Unix programming"/><title type="text">Program to find File types</title><content type="html">&lt;div align="center"&gt;&lt;strong&gt;FINDING FILE TYPES USING UNIX PROGRAMS&lt;/strong&gt;&lt;/div&gt;&lt;div align="center"&gt;&lt;strong&gt;&lt;/strong&gt; &lt;/div&gt;&lt;div align="left"&gt;&lt;br /&gt;#include&lt;stdio.h&gt;&lt;br /&gt;#include&lt;sys/stat.h&gt;&lt;br /&gt;#include&lt;sys/types.h&gt;&lt;br /&gt;#include&lt;fcntl.h&gt;&lt;br /&gt;#include&lt;string.h&gt;&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;  char fname[30];&lt;br /&gt;  int i,ch;&lt;br /&gt;  struct stat buf;&lt;br /&gt;  do&lt;br /&gt;  {&lt;br /&gt;  printf("\n Enter the filename: \n");&lt;br /&gt;  scanf("%s",fname);&lt;br /&gt;  i=lstat(fname,&amp;amp;buf);&lt;br /&gt;&lt;br /&gt;  if(i==0)&lt;br /&gt;  {&lt;br /&gt;&lt;br /&gt; if(S_ISREG(buf.st_mode))&lt;br /&gt;   printf("\n It is a Regular File");&lt;br /&gt; if(S_ISDIR(buf.st_mode))&lt;br /&gt;   printf("\n It is a Directory File");&lt;br /&gt; if(S_ISCHR(buf.st_mode))&lt;br /&gt;   printf("\n It is a Character File");&lt;br /&gt; if (S_ISBLK(buf.st_mode))&lt;br /&gt;   printf("\n It is a Block File");&lt;br /&gt; if(S_ISFIFO(buf.st_mode))&lt;br /&gt;   printf("\n It is a Fifo File");&lt;br /&gt; if(S_ISLNK(buf.st_mode))&lt;br /&gt;   printf("\n It is a Link File");&lt;br /&gt; if(S_ISSOCK(buf.st_mode))&lt;br /&gt;   printf("\n It is a Socket File");&lt;br /&gt;&lt;br /&gt; }  &lt;br /&gt;&lt;br /&gt; printf(“DO YOU WANT TO CONTINUE:\n”);&lt;br /&gt; scanf(“%d”,&amp;amp;ch);&lt;br /&gt;}&lt;br /&gt;while(ch!=0);&lt;br /&gt;}&lt;/div&gt;</content><link href="http://123bytes.blogspot.com/feeds/9204671789181258335/comments/default" rel="replies" title="Post Comments" type="application/atom+xml"/><link href="http://www.blogger.com/comment/fullpage/post/3930802340726048488/9204671789181258335" rel="replies" title="0 Comments" type="text/html"/><link href="http://www.blogger.com/feeds/3930802340726048488/posts/default/9204671789181258335" rel="edit" type="application/atom+xml"/><link href="http://www.blogger.com/feeds/3930802340726048488/posts/default/9204671789181258335" rel="self" type="application/atom+xml"/><link href="http://123bytes.blogspot.com/2010/05/program-to-find-file-types.html" rel="alternate" title="Program to find File types" type="text/html"/><author><name>Ganesh</name><uri>http://www.blogger.com/profile/02324863064543496197</uri><email>noreply@blogger.com</email><gd:image height="16" rel="http://schemas.google.com/g/2005#thumbnail" src="https://img1.blogblog.com/img/b16-rounded.gif" width="16"/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3930802340726048488.post-2299603235335451119</id><published>2010-05-22T12:30:00.000-07:00</published><updated>2010-05-22T12:32:33.851-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Sample unix programs"/><category scheme="http://www.blogger.com/atom/ns#" term="Unix programming"/><title type="text">FILE OPERATIONS USING UNIX PROGRAMMING</title><content type="html">&lt;p align="center"&gt;&lt;strong&gt;FILE OPERATIONS USING UNIX PROGRAMMING&lt;/strong&gt;&lt;/p&gt;&lt;p align="left"&gt;#include&lt;fcntl.h&gt;&lt;br /&gt;#include&lt;stdio.h&gt;&lt;br /&gt;#include&lt;sys/types.h&gt;&lt;br /&gt;#include&lt;sys/stat.h&gt;&lt;br /&gt;#include&lt;string.h&gt;&lt;br /&gt;&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;int fd,ch,n,len,p;&lt;br /&gt;char name[20],str[50],buf[40];&lt;br /&gt;do&lt;br /&gt;{&lt;br /&gt;printf("Menu\n");&lt;br /&gt;printf("1.Create a file\n");&lt;br /&gt;printf("2.Open a file\n");&lt;br /&gt;printf("3.Writing to a file\n");&lt;br /&gt;printf("4.Reading from  a file\n");&lt;br /&gt;printf("5.Exit\n");&lt;br /&gt;printf("Enter the choice[1-4]:\n");&lt;br /&gt;scanf("%d",&amp;amp;ch);&lt;br /&gt;&lt;br /&gt;switch(ch)&lt;br /&gt;{&lt;br /&gt;  case 1:&lt;br /&gt;    printf("Enter the filename:\n");&lt;br /&gt;    getchar();&lt;br /&gt;    gets(name);&lt;br /&gt;    fd=creat(name,S_IRWXU);&lt;br /&gt;    printf("File Created\n");&lt;br /&gt;    close(fd);&lt;br /&gt;    break;&lt;br /&gt;  case 2:&lt;br /&gt;    printf("Enter the filename to open:\n");&lt;br /&gt;    getchar();&lt;br /&gt;    gets(name);&lt;br /&gt;    fd=open(name,O_RDWR);&lt;br /&gt;    printf("%d",fd);&lt;br /&gt;    if(fd!=3)&lt;br /&gt;     {&lt;br /&gt;       fd=open(name,O_CREAT  O_RDWR);&lt;br /&gt;       printf("File is created\n");&lt;br /&gt;     }&lt;br /&gt;     else&lt;br /&gt;      printf("File Already Exist\n");&lt;br /&gt;      close(fd);&lt;br /&gt;      break;&lt;br /&gt;  case 3:&lt;br /&gt;    printf("Enter the filename to Write:\n");&lt;br /&gt;    getchar();&lt;br /&gt;    gets(name);&lt;br /&gt;    fd=open(name, O_RDWR);&lt;br /&gt;    printf("X=%d",fd);&lt;br /&gt;    if (fd==3)&lt;br /&gt;    {&lt;br /&gt;      printf("File Already Exist\n");&lt;br /&gt;      printf("Are you want to Append or overwrite:\n");&lt;br /&gt;      printf("0-Append\n");&lt;br /&gt;      printf("1-Overwrite\n");&lt;br /&gt;      printf("Enter your Choice[1-0]:");&lt;br /&gt;      scanf("%d",&amp;amp;ch);&lt;br /&gt;      if(ch==0)&lt;br /&gt;        lseek(fd,0,SEEK_END);&lt;br /&gt;      else&lt;br /&gt;        lseek(fd,0,SEEK_SET);&lt;br /&gt;    }&lt;br /&gt;    else&lt;br /&gt;    {&lt;br /&gt;     fd=open(name,O_CREAT  O_RDWR,S_IRWXU);&lt;br /&gt;     printf("New File is created\n");&lt;br /&gt;    }&lt;br /&gt;    printf("Enter the String to Write\n");&lt;br /&gt;    scanf("%s",buf);&lt;br /&gt;    len=strlen(buf);&lt;br /&gt;    write(fd,buf,len);  &lt;br /&gt;    close(fd);&lt;br /&gt;    break;&lt;br /&gt;  case 4:&lt;br /&gt;    printf("Enter the filename to read the content:\n");&lt;br /&gt;    getchar();&lt;br /&gt;    gets(name);&lt;br /&gt;    fd=open(name,O_RDWR);&lt;br /&gt;    if(fd==3)&lt;br /&gt;     {&lt;br /&gt;       printf("already exist!\n");&lt;br /&gt;       printf("From where you want to read :\n 0-Starting              position \n (1-n)-other postion :\n");&lt;br /&gt;       scanf("%d",&amp;amp;p);&lt;br /&gt;       lseek(fd,p,SEEK_SET);&lt;br /&gt;       n=read(fd,buf,10);&lt;br /&gt;       buf[n]='\0';&lt;br /&gt;       printf("The content of the file is...%s\n",buf);&lt;br /&gt;     }&lt;br /&gt;    else&lt;br /&gt;     {&lt;br /&gt;      fd=open(name,O_CREAT  O_RDWR,S_IRWXU);&lt;br /&gt;      printf("Newly Created No data to Read!");&lt;br /&gt;     }&lt;br /&gt;   close(fd);&lt;br /&gt;   break;   &lt;br /&gt;  }&lt;br /&gt;  }&lt;br /&gt;  while(ch&lt;=4);&lt;br /&gt;}&lt;br /&gt; &lt;/p&gt;</content><link href="http://123bytes.blogspot.com/feeds/2299603235335451119/comments/default" rel="replies" title="Post Comments" type="application/atom+xml"/><link href="http://www.blogger.com/comment/fullpage/post/3930802340726048488/2299603235335451119" rel="replies" title="0 Comments" type="text/html"/><link href="http://www.blogger.com/feeds/3930802340726048488/posts/default/2299603235335451119" rel="edit" type="application/atom+xml"/><link href="http://www.blogger.com/feeds/3930802340726048488/posts/default/2299603235335451119" rel="self" type="application/atom+xml"/><link href="http://123bytes.blogspot.com/2010/05/file-operations-using-unix-programming.html" rel="alternate" title="FILE OPERATIONS USING UNIX PROGRAMMING" type="text/html"/><author><name>Ganesh</name><uri>http://www.blogger.com/profile/02324863064543496197</uri><email>noreply@blogger.com</email><gd:image height="16" rel="http://schemas.google.com/g/2005#thumbnail" src="https://img1.blogblog.com/img/b16-rounded.gif" width="16"/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3930802340726048488.post-5895996645015168874</id><published>2010-05-22T12:28:00.000-07:00</published><updated>2010-05-22T12:29:23.915-07:00</updated><title type="text">SAMPLE JAVA BEAN PROGRAM</title><content type="html">&lt;div align="center"&gt;&lt;strong&gt;SAMPLE JAVA BEAN PROGRAM TO DRAW DIFFERENT SHAPES&lt;/strong&gt;&lt;/div&gt;
&lt;br /&gt;/* &lt;html&gt; &lt;applet code="gkbean.class" height="500" width="500"&gt;&lt;/applet&gt;&lt;/html&gt;*/
&lt;br /&gt;
&lt;br /&gt;import java.awt.*;
&lt;br /&gt;import java.awt.Color;
&lt;br /&gt;import java.awt.Graphics;
&lt;br /&gt;import java.applet.*;
&lt;br /&gt;import java.applet.Applet;
&lt;br /&gt;//import java.io.Serrializable;
&lt;br /&gt;
&lt;br /&gt;public class gkbean extends Applet
&lt;br /&gt;{
&lt;br /&gt;
&lt;br /&gt;public void init()
&lt;br /&gt;{
&lt;br /&gt;setSize(400,400);
&lt;br /&gt;setBackground(Color.white);
&lt;br /&gt;repaint();
&lt;br /&gt;}
&lt;br /&gt;
&lt;br /&gt;public void paint(Graphics g)
&lt;br /&gt;{
&lt;br /&gt;g.drawRect(50,50,100,100);
&lt;br /&gt;g.setColor(Color.blue);
&lt;br /&gt;g.fillRect(150,150,200,200);
&lt;br /&gt;g.setColor(Color.red);
&lt;br /&gt;g.drawLine(200,200,300,300);
&lt;br /&gt;}
&lt;br /&gt;}
&lt;br /&gt;</content><link href="http://123bytes.blogspot.com/feeds/5895996645015168874/comments/default" rel="replies" title="Post Comments" type="application/atom+xml"/><link href="http://www.blogger.com/comment/fullpage/post/3930802340726048488/5895996645015168874" rel="replies" title="0 Comments" type="text/html"/><link href="http://www.blogger.com/feeds/3930802340726048488/posts/default/5895996645015168874" rel="edit" type="application/atom+xml"/><link href="http://www.blogger.com/feeds/3930802340726048488/posts/default/5895996645015168874" rel="self" type="application/atom+xml"/><link href="http://123bytes.blogspot.com/2010/05/sample-java-bean-program.html" rel="alternate" title="SAMPLE JAVA BEAN PROGRAM" type="text/html"/><author><name>Ganesh</name><uri>http://www.blogger.com/profile/02324863064543496197</uri><email>noreply@blogger.com</email><gd:image height="16" rel="http://schemas.google.com/g/2005#thumbnail" src="https://img1.blogblog.com/img/b16-rounded.gif" width="16"/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3930802340726048488.post-6503251322352577498</id><published>2010-05-22T12:26:00.000-07:00</published><updated>2010-05-22T12:27:32.677-07:00</updated><title type="text">FILE OPERATIONS USING RMI</title><content type="html">&lt;div align="center"&gt;&lt;strong&gt;FILE CONCATENATION USING RMI&lt;/strong&gt;&lt;/div&gt;&lt;br /&gt;PROGRAM:&lt;br /&gt;&lt;br /&gt;//Interface&lt;br /&gt;&lt;br /&gt;import java.rmi.*;&lt;br /&gt;public interface FileIn extends Remote&lt;br /&gt;{&lt;br /&gt;      public String copyFile1(String Name)throws Exception;&lt;br /&gt;      public String copyFile2(String Name)throws Exception;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt;//Implementation&lt;br /&gt;&lt;br /&gt;import  java.rmi.*;&lt;br /&gt;import java.rmi.server.*;&lt;br /&gt;import java.io.*;&lt;br /&gt;&lt;br /&gt;public class FileIm extends UnicastRemoteObject implements FileIn&lt;br /&gt;{&lt;br /&gt;      public File f1,f2;&lt;br /&gt;      public FileReader f3,f4;&lt;br /&gt;      public FileIm() throws Exception&lt;br /&gt;        {     }&lt;br /&gt;    &lt;br /&gt;  public String copyFile1(String fileName) throws Exception&lt;br /&gt;        {&lt;br /&gt;         f1=new File(fileName);&lt;br /&gt;         f3=new FileReader(f1);&lt;br /&gt;         int x;&lt;br /&gt;         String res="";&lt;br /&gt;         while((x=f3.read())!=-1)&lt;br /&gt;         {&lt;br /&gt;         res=res+(char)x;&lt;br /&gt;         }&lt;br /&gt;         f3.close();&lt;br /&gt;         return res;&lt;br /&gt;         }&lt;br /&gt; public String copyFile2(String fileName) throws Exception&lt;br /&gt;        {&lt;br /&gt;         f2=new File(fileName);&lt;br /&gt;         f4=new FileReader(f2);&lt;br /&gt;         int y;&lt;br /&gt;         String res1="";&lt;br /&gt;        while((y=f4.read())!=-1)&lt;br /&gt;        {&lt;br /&gt;        res1=res1+(char)y;&lt;br /&gt;        }&lt;br /&gt;        f4.close();&lt;br /&gt;        return res1;&lt;br /&gt;        }&lt;br /&gt;}                  &lt;br /&gt;&lt;br /&gt;//Client&lt;br /&gt;&lt;br /&gt;import java.rmi.*;&lt;br /&gt;import java.rmi.server.*;&lt;br /&gt;import java.io.*;&lt;br /&gt;public class FileCli&lt;br /&gt;{&lt;br /&gt;public File f5;&lt;br /&gt;public FileWriter f6;&lt;br /&gt;public FileCli() throws Exception&lt;br /&gt;{&lt;br /&gt;f5=new File("prince.txt");&lt;br /&gt;f6=new FileWriter(f5);&lt;br /&gt;String s1=" ";&lt;br /&gt;String s2= " ";&lt;br /&gt;String s=" ";&lt;br /&gt;FileIn inter1=(FileIn)Naming.lookup("rmi://172.16.1.45/mca1");&lt;br /&gt;&lt;br /&gt;FileIn inter2=(FileIn)Naming.lookup("rmi://172.16.1.45/mca2");                                                       s=inter1.copyFile1("King.txt");                                                   s1=inter2.copyFile2("Queen.txt");                                                    s2=s+s1;&lt;br /&gt;f6.write(s2,0,s2.length());&lt;br /&gt;f6.close();&lt;br /&gt;}&lt;br /&gt;public static void main(String[]arg) throws Exception&lt;br /&gt;{                 &lt;br /&gt;FileCli Object=new FileCli();&lt;br /&gt;}&lt;br /&gt;}   &lt;br /&gt;       &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;//Server&lt;br /&gt;&lt;br /&gt;import java.rmi.*;&lt;br /&gt;import java.rmi.server.*;&lt;br /&gt;public class FileSer&lt;br /&gt; {&lt;br /&gt;public FileSer() throws Exception&lt;br /&gt;{&lt;br /&gt;FileIm Obj1=new FileIm();&lt;br /&gt;FileIm Obj2=new FileIm();&lt;br /&gt;Naming.rebind("mca1",Obj1);&lt;br /&gt;Naming.rebind("mca2",Obj2);&lt;br /&gt;System.out.println("Server Starts...");&lt;br /&gt;}&lt;br /&gt;public static void main(String[]arg) throws Exception&lt;br /&gt;{&lt;br /&gt;FileSer Object=new FileSer();&lt;br /&gt;}&lt;br /&gt;}</content><link href="http://123bytes.blogspot.com/feeds/6503251322352577498/comments/default" rel="replies" title="Post Comments" type="application/atom+xml"/><link href="http://www.blogger.com/comment/fullpage/post/3930802340726048488/6503251322352577498" rel="replies" title="0 Comments" type="text/html"/><link href="http://www.blogger.com/feeds/3930802340726048488/posts/default/6503251322352577498" rel="edit" type="application/atom+xml"/><link href="http://www.blogger.com/feeds/3930802340726048488/posts/default/6503251322352577498" rel="self" type="application/atom+xml"/><link href="http://123bytes.blogspot.com/2010/05/file-operations-using-rmi.html" rel="alternate" title="FILE OPERATIONS USING RMI" type="text/html"/><author><name>Ganesh</name><uri>http://www.blogger.com/profile/02324863064543496197</uri><email>noreply@blogger.com</email><gd:image height="16" rel="http://schemas.google.com/g/2005#thumbnail" src="https://img1.blogblog.com/img/b16-rounded.gif" width="16"/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3930802340726048488.post-4910979072511895790</id><published>2010-05-22T12:23:00.000-07:00</published><updated>2010-05-22T12:25:45.897-07:00</updated><title type="text">Addition of Two numbers using RMI</title><content type="html">&lt;strong&gt;The program for addition of two numbers using the RMI concept in Java&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;// interface&lt;br /&gt;import java.rmi.*;&lt;br /&gt;&lt;br /&gt;public interface RmiExample extends Remote&lt;br /&gt;{&lt;br /&gt;public int add(int a ,int b) throws RemoteException;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;//implementation&lt;br /&gt;&lt;br /&gt;import java.rmi.*;&lt;br /&gt;import java.rmi.server.*;&lt;br /&gt;public class RmiImpl extends UnicastRemoteObject implements RmiExample&lt;br /&gt;{&lt;br /&gt;     public RmiImpl() throws RemoteException&lt;br /&gt;       {}&lt;br /&gt;     public int add(int a,int b) throws RemoteException&lt;br /&gt;       {&lt;br /&gt;         return a+b;&lt;br /&gt;       }&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;//client&lt;br /&gt;&lt;br /&gt;import java.rmi.*;&lt;br /&gt;import java.rmi.server.*;&lt;br /&gt;public class Client&lt;br /&gt;{&lt;br /&gt;   public static void main(String[]arg) throws Exception&lt;br /&gt;   {&lt;br /&gt;   RmiExample r=(RmiExample)Naming.lookup("rmi://172.16.1.45/mca");&lt;br /&gt;                System.out.println("The Addition of       a+b"+r.add(5,5));&lt;br /&gt;    }&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;//server&lt;br /&gt;&lt;br /&gt;import java.rmi.*;&lt;br /&gt;import java.rmi.server.*;&lt;br /&gt;public class Server&lt;br /&gt;{&lt;br /&gt;        public static void main(String[]arg) throws RemoteException&lt;br /&gt;     {&lt;br /&gt;      RmiImpl Obj=new RmiImpl();&lt;br /&gt;       try&lt;br /&gt;       {&lt;br /&gt;         Naming.rebind("mca",Obj);&lt;br /&gt;       }&lt;br /&gt;       catch(Exception e){}&lt;br /&gt;&lt;br /&gt;       System.out.println("Server Started...");&lt;br /&gt;         }&lt;br /&gt; }</content><link href="http://123bytes.blogspot.com/feeds/4910979072511895790/comments/default" rel="replies" title="Post Comments" type="application/atom+xml"/><link href="http://www.blogger.com/comment/fullpage/post/3930802340726048488/4910979072511895790" rel="replies" title="0 Comments" type="text/html"/><link href="http://www.blogger.com/feeds/3930802340726048488/posts/default/4910979072511895790" rel="edit" type="application/atom+xml"/><link href="http://www.blogger.com/feeds/3930802340726048488/posts/default/4910979072511895790" rel="self" type="application/atom+xml"/><link href="http://123bytes.blogspot.com/2010/05/addition-of-two-numbers-using-rmi.html" rel="alternate" title="Addition of Two numbers using RMI" type="text/html"/><author><name>Ganesh</name><uri>http://www.blogger.com/profile/02324863064543496197</uri><email>noreply@blogger.com</email><gd:image height="16" rel="http://schemas.google.com/g/2005#thumbnail" src="https://img1.blogblog.com/img/b16-rounded.gif" width="16"/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3930802340726048488.post-1560504335696122360</id><published>2009-04-21T05:10:00.000-07:00</published><updated>2009-04-21T05:12:56.682-07:00</updated><title type="text">Student Marklist Program</title><content type="html">&lt;span style="font-family:trebuchet ms;"&gt;#include&lt;stdio.h&gt;&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;int m[5],i,p,total,sno;&lt;br /&gt;char sname[20],g[5];&lt;br /&gt;float avg;&lt;br /&gt;char res[20],grade;&lt;br /&gt;char subname[5][30]={"Computer Organisation","Business Process","Problem Solving","Accountancy","Data Structures"};&lt;br /&gt;p=0;total=0;&lt;br /&gt;printf("Enter the student details...\n\n");&lt;br /&gt;printf("Enter the Student Name : ");&lt;br /&gt;scanf("%s",sname);&lt;br /&gt;printf("Enter the Student Number : ");&lt;br /&gt;scanf("%d",&amp;amp;sno);&lt;br /&gt;for(i=0;i&lt;5;i++)&lt;br /&gt;{&lt;br /&gt;printf("Enter the %s mark : ",subname[i]);&lt;br /&gt;scanf("%d",&amp;amp;m[i]);&lt;br /&gt;if (m[i]&gt;=80)&lt;br /&gt;{&lt;br /&gt;if (p&lt;1)&lt;br /&gt;{&lt;br /&gt;grade='O';&lt;br /&gt;p=1;&lt;br /&gt;}&lt;br /&gt;g[i]='O';&lt;br /&gt;}&lt;br /&gt;else if(m[i]&gt;=70)&lt;br /&gt;{&lt;br /&gt;if (p&lt;2)&lt;br /&gt;{&lt;br /&gt;grade='A';&lt;br /&gt;p=2;&lt;br /&gt;}&lt;br /&gt;g[i]='A';&lt;br /&gt;}&lt;br /&gt;else if(m[i]&gt;=60)&lt;br /&gt;{&lt;br /&gt;if (p&lt;3)&lt;br /&gt;{&lt;br /&gt;grade='B';&lt;br /&gt;p=3;&lt;br /&gt;}&lt;br /&gt;g[i]='B';&lt;br /&gt;}&lt;br /&gt;else if(m[i]&gt;=50)&lt;br /&gt;{&lt;br /&gt;if (p&lt;4)&lt;br /&gt;{&lt;br /&gt;grade='C';&lt;br /&gt;p=4;&lt;br /&gt;}&lt;br /&gt;g[i]='C';&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;grade='D';&lt;br /&gt;p=5;&lt;br /&gt;g[i]='D';&lt;br /&gt;}&lt;br /&gt;total=total+m[i];&lt;br /&gt;}&lt;br /&gt;avg=(float)total/5;&lt;br /&gt;printf("\n\n\t\t\tSTUDENT MARKLIST\n");&lt;br /&gt;printf("----------------------------------------------------------------------------");&lt;br /&gt;printf("\n\nSTUDENT NAME : %s",sname);&lt;br /&gt;printf("\nROLL NUMBER : %d",sno);&lt;br /&gt;printf("\n\n");&lt;br /&gt;printf("----------------------------------------------------------------------------");&lt;br /&gt;printf("\n\t\tSUBJECT\t\tMARKS\t GRADE\n");&lt;br /&gt;printf("----------------------------------------------------------------------------");&lt;br /&gt;printf("\n");&lt;br /&gt;for(i=0;i&lt;5;i++)&lt;br /&gt;printf("%25s \t%d\t %c\n",subname[i],m[i],g[i]);&lt;br /&gt;printf("\n");&lt;br /&gt;if (grade=='O')&lt;br /&gt;strcpy(res,"OUTSTANDING");&lt;br /&gt;else if (grade=='A')&lt;br /&gt;strcpy(res,"FIRST CLASS");&lt;br /&gt;else if (grade=='B')&lt;br /&gt;strcpy(res,"SECOND CLASS");&lt;br /&gt;else if (grade=='C')&lt;br /&gt;strcpy(res,"THIRD CLASS");&lt;br /&gt;else&lt;br /&gt;strcpy(res,"FAIL");&lt;br /&gt;printf("----------------------------------------------------------------------------");&lt;br /&gt;printf("\nTOTAL : %d",total);&lt;br /&gt;printf("\nAVERAGE : %f",avg);&lt;br /&gt;printf("\nGRADE : %c",grade);&lt;br /&gt;printf("\nRESULT : %s\n\n",res);&lt;br /&gt;printf("----------------------------------------------------------------------------\n\n");&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;</content><link href="http://123bytes.blogspot.com/feeds/1560504335696122360/comments/default" rel="replies" title="Post Comments" type="application/atom+xml"/><link href="http://www.blogger.com/comment/fullpage/post/3930802340726048488/1560504335696122360" rel="replies" title="0 Comments" type="text/html"/><link href="http://www.blogger.com/feeds/3930802340726048488/posts/default/1560504335696122360" rel="edit" type="application/atom+xml"/><link href="http://www.blogger.com/feeds/3930802340726048488/posts/default/1560504335696122360" rel="self" type="application/atom+xml"/><link href="http://123bytes.blogspot.com/2009/04/student-marklist-program.html" rel="alternate" title="Student Marklist Program" type="text/html"/><author><name>Ganesh</name><uri>http://www.blogger.com/profile/02324863064543496197</uri><email>noreply@blogger.com</email><gd:image height="16" rel="http://schemas.google.com/g/2005#thumbnail" src="https://img1.blogblog.com/img/b16-rounded.gif" width="16"/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3930802340726048488.post-1641781250321642443</id><published>2009-04-17T04:22:00.000-07:00</published><updated>2009-04-17T04:23:24.350-07:00</updated><title type="text">Library Book search program</title><content type="html">&lt;span style="font-family:trebuchet ms;"&gt;#include&lt;stdio.h&gt;&lt;br /&gt;struct book&lt;br /&gt;{&lt;br /&gt;int accno;&lt;br /&gt;char tit[20],au[20];&lt;br /&gt;float price;&lt;br /&gt;int av;&lt;br /&gt;char ava[5];&lt;br /&gt;};&lt;br /&gt;struct ent&lt;br /&gt;{&lt;br /&gt;int sid;&lt;br /&gt;int a;&lt;br /&gt;};&lt;br /&gt;int ok;&lt;br /&gt;struct book b[20];&lt;br /&gt;struct ent e[20];&lt;br /&gt;int c,j,i,k=0,l;&lt;br /&gt;void addbook();&lt;br /&gt;void display();&lt;br /&gt;void avail();&lt;br /&gt;void bookdue();&lt;br /&gt;void sauthor();&lt;br /&gt;void stitle();&lt;br /&gt;void saccno();&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;int i=-1;&lt;br /&gt;system("clear");&lt;br /&gt;printf("\t\t\tLIBRARY MANAGEMENT SYSTEM\n");&lt;br /&gt;do&lt;br /&gt;{&lt;br /&gt;printf("\nOperations :\n1.ADD BOOKS TO LIBRARY\n2.DISPLAY BOOKS IN THE LIBRARY\n3.AVAILABILITY\n\ti.SEARCH BOOKS BY ACCESSION NUMBER\n\tii.SEARCH BOOKS BY AUTHOR\n\tiii.SEARCH BOOKS BY TITLE\n4.BOOK DUE(ENTRY)\n5.EXITING THE SYSTEM\n");&lt;br /&gt;printf("\nEnter Your choice : ");&lt;br /&gt;scanf("%d",&amp;amp;c);&lt;br /&gt;switch(c)&lt;br /&gt;{&lt;br /&gt;case 1: addbook(); break;&lt;br /&gt;case 2: display(); break;&lt;br /&gt;case 3: avail(); break;&lt;br /&gt;case 4: bookdue(); break;&lt;br /&gt;}&lt;br /&gt;}while(c!=5);&lt;br /&gt;}&lt;br /&gt;void addbook()&lt;br /&gt;{&lt;br /&gt;i++;&lt;br /&gt;printf("\nEnter the Accession Number(4 digit Number) : ");&lt;br /&gt;scanf("%d",&amp;amp;b[i].accno);&lt;br /&gt;for(j=i-1;j&gt;=0;j--)&lt;br /&gt;{&lt;br /&gt;if (b[j].accno==b[i].accno)&lt;br /&gt;{&lt;br /&gt;i--;&lt;br /&gt;printf("\nThe Accession Number Alreary Exists!\n");&lt;br /&gt;return;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;printf("\nEnter the Book Title(max 20 char) : ");&lt;br /&gt;scanf("%s",b[i].tit);&lt;br /&gt;printf("Enter the Author Name : ");&lt;br /&gt;scanf("%s",b[i].au);&lt;br /&gt;printf("Enter the Price of book : ");&lt;br /&gt;scanf("%f",&amp;amp;b[i].price);&lt;br /&gt;b[i].av=1;&lt;br /&gt;}&lt;br /&gt;void display()&lt;br /&gt;{&lt;br /&gt;printf("\n\t\t\tBOOKS IN THE LIBRARY\n");&lt;br /&gt;printf("ACCNO\tTITLE OF THE BOOK\tAUTHOR OF THE BOOK\tPRICE\tAVAIL\n");&lt;br /&gt;for(j=1;j&lt;=i;j++)&lt;br /&gt;{&lt;br /&gt;if (b[j].av==1)&lt;br /&gt;strcpy(b[j].ava,"YES");&lt;br /&gt;else&lt;br /&gt;strcpy(b[j].ava,"NO");&lt;br /&gt;printf("%d\t%18s\t%18s\t%6.2f\t %s\n",b[j].accno,b[j].tit,b[j].au,b[j].price,b[j].ava);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;void avail()&lt;br /&gt;{&lt;br /&gt;int ch;&lt;br /&gt;do&lt;br /&gt;{&lt;br /&gt;printf("\nChecking books availability by searching in means of \n1.ACCESSION NUMBER\n2.TITLE\n3.AUTHOR\n4.EXIT SEARCHING\n");&lt;br /&gt;printf("Enter your choice : ");&lt;br /&gt;scanf("%d",&amp;amp;ch);&lt;br /&gt;switch(ch)&lt;br /&gt;{&lt;br /&gt;case 1: saccno(); break;&lt;br /&gt;case 2: stitle(); break;&lt;br /&gt;case 3: sauthor(); break;&lt;br /&gt;}&lt;br /&gt;}while(ch!=4);&lt;br /&gt;}&lt;br /&gt;void bookdue()&lt;br /&gt;{&lt;br /&gt;int acc,id;&lt;br /&gt;printf("\nEnter the Accession Number To get Book(4 digit number) : ");&lt;br /&gt;scanf("%d",&amp;amp;acc);&lt;br /&gt;for(j=0;j&lt;=i;j++)&lt;br /&gt;if (b[j].accno==acc)&lt;br /&gt;{&lt;br /&gt;if (b[j].av==1)&lt;br /&gt;{&lt;br /&gt;printf("\nEnter the Student ID(3 digit number) : ");&lt;br /&gt;scanf("%d",&amp;amp;id);&lt;br /&gt;//k++;&lt;br /&gt;for(l=0;l&lt;=k;l++)&lt;br /&gt;if (e[l].sid==id)&lt;br /&gt;{&lt;br /&gt;if (e[l].a&lt;2)&lt;br /&gt;{&lt;br /&gt;printf("\n Book Due Success!");&lt;br /&gt;b[j].av=0;&lt;br /&gt;e[l].a=e[l].a+1;&lt;br /&gt;return;&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;printf("\n Sorry! You have 3 books on due!");&lt;br /&gt;return;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;printf("\nBook Due Success!");&lt;br /&gt;e[k].sid=id;&lt;br /&gt;e[k].a=0;&lt;br /&gt;b[j].av=0;&lt;br /&gt;k++;&lt;br /&gt;return;&lt;br /&gt;}&lt;br /&gt;printf("\nThis Book on Due!");&lt;br /&gt;return;&lt;br /&gt;}&lt;br /&gt;printf("\nBook Not Available!");&lt;br /&gt;}&lt;br /&gt;void saccno()&lt;br /&gt;{&lt;br /&gt;int ac;&lt;br /&gt;printf("\nEnter the accession to find Book : ");&lt;br /&gt;scanf("%d",&amp;amp;ac);&lt;br /&gt;for(j=0;j&lt;=i;j++)&lt;br /&gt;if(b[j].accno==ac)&lt;br /&gt;{&lt;br /&gt;printf("\nBook Name : %s\nAuthor : %s\nPrice : %f\nAvailability : %s\n",b[j].tit,b[j].au,b[j].price,b[j].ava);&lt;br /&gt;return;&lt;br /&gt;}&lt;br /&gt;printf("\n No such Accession Number available!");&lt;br /&gt;}&lt;br /&gt;void sauthor()&lt;br /&gt;{&lt;br /&gt;char author[20];&lt;br /&gt;int ok=0;&lt;br /&gt;printf("\nEnter the author name to find Books : ");&lt;br /&gt;scanf("%s",author);&lt;br /&gt;for(j=0;j&lt;=i;j++)&lt;br /&gt;if (strcmp(author,b[j].au)==0)&lt;br /&gt;{&lt;br /&gt;printf("\nAcc. No : %d\nBook Name : %s\nPrice : %f\nAvailability : %s\n",b[j].accno,b[j].tit,b[j].price,b[j].ava);&lt;br /&gt;ok=1;&lt;br /&gt;}&lt;br /&gt;if (ok!=1)&lt;br /&gt;printf("\n No books available!");&lt;br /&gt;}&lt;br /&gt;void stitle()&lt;br /&gt;{&lt;br /&gt;char title[20];&lt;br /&gt;int ok1=0;&lt;br /&gt;printf("\nEnter the Title to find the book : ");&lt;br /&gt;scanf("%s",title);&lt;br /&gt;for(j=0;j&lt;=i;j++)&lt;br /&gt;if (strcmp(title,b[j].tit)==0)&lt;br /&gt;{&lt;br /&gt;printf("\nAcc No : %d\nAuthor : %s\nPrice : %f\nAvailability : %s\n",b[j].accno,b[j].au,b[j].price,b[j].ava);&lt;br /&gt;ok1=1;&lt;br /&gt;}&lt;br /&gt;if (ok!=1)&lt;br /&gt;printf("\nNo Such book available!");&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;</content><link href="http://123bytes.blogspot.com/feeds/1641781250321642443/comments/default" rel="replies" title="Post Comments" type="application/atom+xml"/><link href="http://www.blogger.com/comment/fullpage/post/3930802340726048488/1641781250321642443" rel="replies" title="0 Comments" type="text/html"/><link href="http://www.blogger.com/feeds/3930802340726048488/posts/default/1641781250321642443" rel="edit" type="application/atom+xml"/><link href="http://www.blogger.com/feeds/3930802340726048488/posts/default/1641781250321642443" rel="self" type="application/atom+xml"/><link href="http://123bytes.blogspot.com/2009/04/library-book-search-program.html" rel="alternate" title="Library Book search program" type="text/html"/><author><name>Ganesh</name><uri>http://www.blogger.com/profile/02324863064543496197</uri><email>noreply@blogger.com</email><gd:image height="16" rel="http://schemas.google.com/g/2005#thumbnail" src="https://img1.blogblog.com/img/b16-rounded.gif" width="16"/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3930802340726048488.post-395275159168105847</id><published>2009-04-17T04:21:00.000-07:00</published><updated>2010-01-09T05:15:50.127-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Conceptial programs"/><title type="text">Insertion sort program</title><content type="html">
&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;#include&lt;stdio.h&gt;
&lt;br /&gt;main()
&lt;br /&gt;{
&lt;br /&gt;int a[20],i,j,n,t;
&lt;br /&gt;printf("\nEnter the number of elements : ");
&lt;br /&gt;scanf("%d",&amp;amp;n);
&lt;br /&gt;printf("\nEnter the numbers to be sorted : \n");
&lt;br /&gt;for(i=0;i&lt;n;i++)
&lt;br /&gt;scanf("%d",&amp;amp;a[i]);
&lt;br /&gt;for(i=0;i&lt;n;i++)
&lt;br /&gt;{
&lt;br /&gt;t=a[i];
&lt;br /&gt;j=i+1;
&lt;br /&gt;while(t&lt;a[j])
&lt;br /&gt;{
&lt;br /&gt;a[j+1]=a[j];
&lt;br /&gt;j=j-1;
&lt;br /&gt;if (j&lt;=0)
&lt;br /&gt;break;
&lt;br /&gt;}
&lt;br /&gt;a[j+1]=t;
&lt;br /&gt;}
&lt;br /&gt;printf("\nSorted elements : \n");
&lt;br /&gt;for(i=0;i&lt;n;i++)
&lt;br /&gt;printf("%d\n",a[i]);
&lt;br /&gt;}
&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;</content><link href="http://123bytes.blogspot.com/feeds/395275159168105847/comments/default" rel="replies" title="Post Comments" type="application/atom+xml"/><link href="http://www.blogger.com/comment/fullpage/post/3930802340726048488/395275159168105847" rel="replies" title="0 Comments" type="text/html"/><link href="http://www.blogger.com/feeds/3930802340726048488/posts/default/395275159168105847" rel="edit" type="application/atom+xml"/><link href="http://www.blogger.com/feeds/3930802340726048488/posts/default/395275159168105847" rel="self" type="application/atom+xml"/><link href="http://123bytes.blogspot.com/2009/04/insertion-sort-program.html" rel="alternate" title="Insertion sort program" type="text/html"/><author><name>Ganesh</name><uri>http://www.blogger.com/profile/02324863064543496197</uri><email>noreply@blogger.com</email><gd:image height="16" rel="http://schemas.google.com/g/2005#thumbnail" src="https://img1.blogblog.com/img/b16-rounded.gif" width="16"/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3930802340726048488.post-2736868200892205246</id><published>2009-04-17T04:19:00.000-07:00</published><updated>2009-04-17T04:20:31.272-07:00</updated><title type="text">Fibonacci using recursion program</title><content type="html">&lt;p&gt;
&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;#include&lt;stdio.h&gt;
&lt;br /&gt;int fibo(int);
&lt;br /&gt;main()
&lt;br /&gt;{
&lt;br /&gt;int i,n,s,sum=0;
&lt;br /&gt;printf("\nEnter the limit : ");
&lt;br /&gt;scanf("%d",&amp;amp;n);
&lt;br /&gt;for(i=0;i&lt;n;i++)
&lt;br /&gt;{
&lt;br /&gt;s=fibo(i);
&lt;br /&gt;printf("%d\n",s);
&lt;br /&gt;}
&lt;br /&gt;//printf("%d",sum);
&lt;br /&gt;}
&lt;br /&gt;int fibo(int i)
&lt;br /&gt;{
&lt;br /&gt;if (i==0)
&lt;br /&gt;return (0);
&lt;br /&gt;if ((i==1)(i==2))
&lt;br /&gt;return (1);
&lt;br /&gt;else
&lt;br /&gt;return fibo(i-1)+fibo(i-2);
&lt;br /&gt;}&lt;/span&gt;&lt;/p&gt;&lt;p&gt; &lt;/p&gt;</content><link href="http://123bytes.blogspot.com/feeds/2736868200892205246/comments/default" rel="replies" title="Post Comments" type="application/atom+xml"/><link href="http://www.blogger.com/comment/fullpage/post/3930802340726048488/2736868200892205246" rel="replies" title="0 Comments" type="text/html"/><link href="http://www.blogger.com/feeds/3930802340726048488/posts/default/2736868200892205246" rel="edit" type="application/atom+xml"/><link href="http://www.blogger.com/feeds/3930802340726048488/posts/default/2736868200892205246" rel="self" type="application/atom+xml"/><link href="http://123bytes.blogspot.com/2009/04/fibonacci-using-recursion-program.html" rel="alternate" title="Fibonacci using recursion program" type="text/html"/><author><name>Ganesh</name><uri>http://www.blogger.com/profile/02324863064543496197</uri><email>noreply@blogger.com</email><gd:image height="16" rel="http://schemas.google.com/g/2005#thumbnail" src="https://img1.blogblog.com/img/b16-rounded.gif" width="16"/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3930802340726048488.post-4613644696652989777</id><published>2009-04-17T04:18:00.000-07:00</published><updated>2009-04-17T04:19:24.686-07:00</updated><title type="text">Hybrid Inheritance - sample program</title><content type="html">&lt;span style="font-family:trebuchet ms;"&gt;/* $ Hybird Inheritance with Employee details $ */
&lt;br /&gt;#include&lt;iostream&gt;
&lt;br /&gt;using namespace std;
&lt;br /&gt;class emp
&lt;br /&gt;{
&lt;br /&gt;int eno;
&lt;br /&gt;char ename[20];
&lt;br /&gt;public:
&lt;br /&gt;void getdata()
&lt;br /&gt;{
&lt;br /&gt;cout&lt;&lt;"\nEnter the Employee number : ";
&lt;br /&gt;cin&gt;&gt;eno;
&lt;br /&gt;cout&lt;&lt;"\nEnter the employee Name : ";
&lt;br /&gt;cin&gt;&gt;ename;
&lt;br /&gt;}
&lt;br /&gt;void display()
&lt;br /&gt;{
&lt;br /&gt;cout&lt;&lt;"\nEmployee Number : "&lt;&lt;eno&lt;&lt;endl;
&lt;br /&gt;cout&lt;&lt;"\nEmployee Name : "&lt;&lt;ename&lt;&lt;endl;
&lt;br /&gt;}
&lt;br /&gt;};
&lt;br /&gt;class ebasic:public emp
&lt;br /&gt;{
&lt;br /&gt;public:
&lt;br /&gt;float bpay;
&lt;br /&gt;char degn[20];
&lt;br /&gt;void getdata1()
&lt;br /&gt;{
&lt;br /&gt;cout&lt;&lt;"\nEnter the designation : ";
&lt;br /&gt;cin&gt;&gt;degn;
&lt;br /&gt;cout&lt;&lt;"Enter the Basic pay : ";
&lt;br /&gt;cin&gt;&gt;bpay;
&lt;br /&gt;}
&lt;br /&gt;void display1()
&lt;br /&gt;{
&lt;br /&gt;cout&lt;&lt;"\nEmployee Designation : "&lt;&lt;degn&lt;&lt;endl;
&lt;br /&gt;cout&lt;&lt;"Employee Basic Pay : "&lt;&lt;bpay&lt;&lt;endl;
&lt;br /&gt;}
&lt;br /&gt;};
&lt;br /&gt;class epers
&lt;br /&gt;{
&lt;br /&gt;char addr[50],cname[20];
&lt;br /&gt;//int age;
&lt;br /&gt;public:
&lt;br /&gt;void getdata2()
&lt;br /&gt;{
&lt;br /&gt;cout&lt;&lt;"\nEnter the Name of the company : ";
&lt;br /&gt;cin&gt;&gt;cname;
&lt;br /&gt;cout&lt;&lt;"\nEnter the address of the company..."&lt;&lt;endl;
&lt;br /&gt;cin&gt;&gt;addr;
&lt;br /&gt;}
&lt;br /&gt;void display2()
&lt;br /&gt;{
&lt;br /&gt;cout&lt;&lt;"\nCompany Name : "&lt;&lt;cname&lt;&lt;endl;
&lt;br /&gt;cout&lt;&lt;"Company address : "&lt;&lt;endl&lt;&lt;addr&lt;&lt;endl;
&lt;br /&gt;}
&lt;br /&gt;};
&lt;br /&gt;class edetail:public epers,public ebasic
&lt;br /&gt;{
&lt;br /&gt;float sal,hra,da;
&lt;br /&gt;public:
&lt;br /&gt;void calc()
&lt;br /&gt;{
&lt;br /&gt;hra=(bpay*0.4);
&lt;br /&gt;da=(bpay*0.75);
&lt;br /&gt;sal=bpay+hra+da;
&lt;br /&gt;}
&lt;br /&gt;void display3()
&lt;br /&gt;{
&lt;br /&gt;cout&lt;&lt;"Basic Pay : "&lt;&lt;bpay&lt;&lt;endl;
&lt;br /&gt;cout&lt;&lt;"H.R.A : "&lt;&lt;hra&lt;&lt;endl;
&lt;br /&gt;cout&lt;&lt;" D.A : "&lt;&lt;da&lt;&lt;endl;
&lt;br /&gt;cout&lt;&lt;" Salary : "&lt;&lt;sal&lt;&lt;endl;
&lt;br /&gt;}
&lt;br /&gt;};
&lt;br /&gt;main()
&lt;br /&gt;{
&lt;br /&gt;edetail ed;
&lt;br /&gt;ed.getdata();
&lt;br /&gt;ed.getdata1();
&lt;br /&gt;ed.getdata2();
&lt;br /&gt;ed.calc();
&lt;br /&gt;ed.display();
&lt;br /&gt;ed.display1();
&lt;br /&gt;ed.display2();
&lt;br /&gt;ed.display3();
&lt;br /&gt;}
&lt;br /&gt;
&lt;br /&gt;&lt;/span&gt; </content><link href="http://123bytes.blogspot.com/feeds/4613644696652989777/comments/default" rel="replies" title="Post Comments" type="application/atom+xml"/><link href="http://www.blogger.com/comment/fullpage/post/3930802340726048488/4613644696652989777" rel="replies" title="0 Comments" type="text/html"/><link href="http://www.blogger.com/feeds/3930802340726048488/posts/default/4613644696652989777" rel="edit" type="application/atom+xml"/><link href="http://www.blogger.com/feeds/3930802340726048488/posts/default/4613644696652989777" rel="self" type="application/atom+xml"/><link href="http://123bytes.blogspot.com/2009/04/hybrid-inheritance-sample-program.html" rel="alternate" title="Hybrid Inheritance - sample program" type="text/html"/><author><name>Ganesh</name><uri>http://www.blogger.com/profile/02324863064543496197</uri><email>noreply@blogger.com</email><gd:image height="16" rel="http://schemas.google.com/g/2005#thumbnail" src="https://img1.blogblog.com/img/b16-rounded.gif" width="16"/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3930802340726048488.post-8472499718643411275</id><published>2009-04-17T04:17:00.000-07:00</published><updated>2010-01-09T05:15:50.127-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Conceptial programs"/><title type="text">Heap sort Program</title><content type="html">&lt;span style="font-family:trebuchet ms;"&gt;#include&lt;stdio.h&gt;
&lt;br /&gt;int n,a[10],k;
&lt;br /&gt;void heapsort(int a[],int n);
&lt;br /&gt;void swap(int b,int c);
&lt;br /&gt;void pushdown(int x,int y);
&lt;br /&gt;main()
&lt;br /&gt;{
&lt;br /&gt;system("clear");
&lt;br /&gt;printf("Enter the number of elements : ");
&lt;br /&gt;scanf("%d",&amp;amp;n);
&lt;br /&gt;printf("\nEnter the elements one by one...\n");
&lt;br /&gt;for(k=0;k&lt;n;k++)
&lt;br /&gt;scanf("%d",&amp;amp;a[k]);
&lt;br /&gt;for(k=0;k&lt;n;k++)
&lt;br /&gt;heapsort(a,n);
&lt;br /&gt;printf("\nElements after the Heap sort...\n");
&lt;br /&gt;for(k=0;k&lt;n;k++)
&lt;br /&gt;printf("%d\n",a[k]);
&lt;br /&gt;}
&lt;br /&gt;void heapsort(int a[],int n)
&lt;br /&gt;{
&lt;br /&gt;int i;
&lt;br /&gt;for(i=n/2;i&gt;=1;i--)
&lt;br /&gt;pushdown(i,n);
&lt;br /&gt;for(i=n;i&gt;=2;i--)
&lt;br /&gt;{
&lt;br /&gt;swap(1,i);
&lt;br /&gt;pushdown(1,i-1);
&lt;br /&gt;}
&lt;br /&gt;}
&lt;br /&gt;void pushdown(int first,int last)
&lt;br /&gt;{
&lt;br /&gt;int r;
&lt;br /&gt;r=first;
&lt;br /&gt;while(r&lt;=last/2)
&lt;br /&gt;{
&lt;br /&gt;if(last==2*r)
&lt;br /&gt;{
&lt;br /&gt;if (a[r]&gt;a[2*r])
&lt;br /&gt;swap(r,2*r);
&lt;br /&gt;r=last;
&lt;br /&gt;}
&lt;br /&gt;else
&lt;br /&gt;{
&lt;br /&gt;if (a[r]&gt;a[2*r]&amp;amp;&amp;amp;a[2*r]&lt;=a[2*r+1])
&lt;br /&gt;{
&lt;br /&gt;swap(r,2*r);
&lt;br /&gt;r=2*r;
&lt;br /&gt;}
&lt;br /&gt;else if(a[r]&gt;a[2*r+1]&amp;amp;&amp;amp;a[2*r+1]&lt;a[2*r])
&lt;br /&gt;{
&lt;br /&gt;swap(r,2*r+1);
&lt;br /&gt;r=2*r+1;
&lt;br /&gt;}
&lt;br /&gt;else
&lt;br /&gt;r=last;
&lt;br /&gt;}
&lt;br /&gt;}
&lt;br /&gt;}
&lt;br /&gt;void swap(int m,int x)
&lt;br /&gt;{
&lt;br /&gt;int t;
&lt;br /&gt;t=a[m];
&lt;br /&gt;a[m]=a[x];
&lt;br /&gt;a[x]=t;
&lt;br /&gt;}&lt;/span&gt;
&lt;br /&gt;</content><link href="http://123bytes.blogspot.com/feeds/8472499718643411275/comments/default" rel="replies" title="Post Comments" type="application/atom+xml"/><link href="http://www.blogger.com/comment/fullpage/post/3930802340726048488/8472499718643411275" rel="replies" title="1 Comments" type="text/html"/><link href="http://www.blogger.com/feeds/3930802340726048488/posts/default/8472499718643411275" rel="edit" type="application/atom+xml"/><link href="http://www.blogger.com/feeds/3930802340726048488/posts/default/8472499718643411275" rel="self" type="application/atom+xml"/><link href="http://123bytes.blogspot.com/2009/04/heap-sort-program.html" rel="alternate" title="Heap sort Program" type="text/html"/><author><name>Ganesh</name><uri>http://www.blogger.com/profile/02324863064543496197</uri><email>noreply@blogger.com</email><gd:image height="16" rel="http://schemas.google.com/g/2005#thumbnail" src="https://img1.blogblog.com/img/b16-rounded.gif" width="16"/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3930802340726048488.post-4043205752582528068</id><published>2009-04-17T04:15:00.000-07:00</published><updated>2009-04-17T04:16:16.588-07:00</updated><title type="text">Floyds Triangle program</title><content type="html">&lt;span style="font-family:trebuchet ms;"&gt;#include&lt;stdio.h&gt;&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;int i,j,k,n;&lt;br /&gt;k=0;&lt;br /&gt;printf("Enter the limit : ");&lt;br /&gt;scanf("%d",&amp;amp;n);&lt;br /&gt;printf("\n\n\t\tFLOYDS TRIANGLE\n\n");&lt;br /&gt;for(i=1;i&lt;=n;i++)&lt;br /&gt;{&lt;br /&gt;for(j=i;j&gt;=1;j--)&lt;br /&gt;printf("%d\t",++k);&lt;br /&gt;printf("\n");&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;sample output:&lt;br /&gt;&lt;br /&gt;1&lt;br /&gt;&lt;br /&gt;2  3&lt;br /&gt;&lt;br /&gt;4  5  6&lt;br /&gt;&lt;br /&gt;6  7  8  9</content><link href="http://123bytes.blogspot.com/feeds/4043205752582528068/comments/default" rel="replies" title="Post Comments" type="application/atom+xml"/><link href="http://www.blogger.com/comment/fullpage/post/3930802340726048488/4043205752582528068" rel="replies" title="0 Comments" type="text/html"/><link href="http://www.blogger.com/feeds/3930802340726048488/posts/default/4043205752582528068" rel="edit" type="application/atom+xml"/><link href="http://www.blogger.com/feeds/3930802340726048488/posts/default/4043205752582528068" rel="self" type="application/atom+xml"/><link href="http://123bytes.blogspot.com/2009/04/floyds-triangle-program.html" rel="alternate" title="Floyds Triangle program" type="text/html"/><author><name>Ganesh</name><uri>http://www.blogger.com/profile/02324863064543496197</uri><email>noreply@blogger.com</email><gd:image height="16" rel="http://schemas.google.com/g/2005#thumbnail" src="https://img1.blogblog.com/img/b16-rounded.gif" width="16"/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3930802340726048488.post-6200017295845433807</id><published>2009-04-17T04:14:00.001-07:00</published><updated>2009-04-17T04:14:40.312-07:00</updated><title type="text">Fibonacci series program</title><content type="html">&lt;span style="font-family:trebuchet ms;"&gt;#include&lt;stdio.h&gt;&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;int i,n,f1,f2,f3;&lt;br /&gt;system("clear");&lt;br /&gt;f1=-1;&lt;br /&gt;f2=1;&lt;br /&gt;printf("Enter the limit : ");&lt;br /&gt;scanf("%d",&amp;amp;n);&lt;br /&gt;printf("The Fibonacci series are....\n");&lt;br /&gt;for(i=1;i&lt;=n;i++)&lt;br /&gt;{&lt;br /&gt;f3=f1+f2;&lt;br /&gt;printf("%d\n",f3);&lt;br /&gt;f1=f2;&lt;br /&gt;f2=f3;&lt;br /&gt;}&lt;br /&gt;}&lt;/span&gt;</content><link href="http://123bytes.blogspot.com/feeds/6200017295845433807/comments/default" rel="replies" title="Post Comments" type="application/atom+xml"/><link href="http://www.blogger.com/comment/fullpage/post/3930802340726048488/6200017295845433807" rel="replies" title="1 Comments" type="text/html"/><link href="http://www.blogger.com/feeds/3930802340726048488/posts/default/6200017295845433807" rel="edit" type="application/atom+xml"/><link href="http://www.blogger.com/feeds/3930802340726048488/posts/default/6200017295845433807" rel="self" type="application/atom+xml"/><link href="http://123bytes.blogspot.com/2009/04/fibonacci-series-program.html" rel="alternate" title="Fibonacci series program" type="text/html"/><author><name>Ganesh</name><uri>http://www.blogger.com/profile/02324863064543496197</uri><email>noreply@blogger.com</email><gd:image height="16" rel="http://schemas.google.com/g/2005#thumbnail" src="https://img1.blogblog.com/img/b16-rounded.gif" width="16"/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3930802340726048488.post-8267575002244166605</id><published>2009-04-17T04:12:00.000-07:00</published><updated>2009-04-17T04:14:02.000-07:00</updated><title type="text">Factorial program</title><content type="html">&lt;span style="font-family:trebuchet ms;"&gt;#include&lt;stdio.h&gt;&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;int n,i;&lt;br /&gt;int fact(int n);&lt;br /&gt;printf("Enter the number : ");&lt;br /&gt;scanf("%d",&amp;amp;n);&lt;br /&gt;printf("\nThe factorial of the given number is %d\n",fact(n));&lt;br /&gt;}&lt;br /&gt;int fact(int f)&lt;br /&gt;{&lt;br /&gt;if ((f==0)(f==1))&lt;br /&gt;return 1;&lt;br /&gt;else&lt;br /&gt;return (f*(fact(f-1)));&lt;br /&gt;}&lt;/span&gt;</content><link href="http://123bytes.blogspot.com/feeds/8267575002244166605/comments/default" rel="replies" title="Post Comments" type="application/atom+xml"/><link href="http://www.blogger.com/comment/fullpage/post/3930802340726048488/8267575002244166605" rel="replies" title="0 Comments" type="text/html"/><link href="http://www.blogger.com/feeds/3930802340726048488/posts/default/8267575002244166605" rel="edit" type="application/atom+xml"/><link href="http://www.blogger.com/feeds/3930802340726048488/posts/default/8267575002244166605" rel="self" type="application/atom+xml"/><link href="http://123bytes.blogspot.com/2009/04/factorial-program.html" rel="alternate" title="Factorial program" type="text/html"/><author><name>Ganesh</name><uri>http://www.blogger.com/profile/02324863064543496197</uri><email>noreply@blogger.com</email><gd:image height="16" rel="http://schemas.google.com/g/2005#thumbnail" src="https://img1.blogblog.com/img/b16-rounded.gif" width="16"/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3930802340726048488.post-4340347114994399007</id><published>2009-04-13T05:30:00.000-07:00</published><updated>2010-01-09T05:15:50.127-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Conceptial programs"/><title type="text">E-series calculation</title><content type="html">
&lt;br /&gt;
&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;#include&lt;stdio.h&gt;
&lt;br /&gt;#include "math.h"
&lt;br /&gt;int fact(int i);
&lt;br /&gt;main()
&lt;br /&gt;{
&lt;br /&gt;float x;
&lt;br /&gt;int n,i=1;
&lt;br /&gt;float term=0.0,sum=0.0;
&lt;br /&gt;printf("\nEnter the limit : ");
&lt;br /&gt;scanf("%d",&amp;amp;n);
&lt;br /&gt;printf("\nEnter the value of x : ");
&lt;br /&gt;scanf("%f",&amp;amp;x);
&lt;br /&gt;x=x*(3.14/180.0);
&lt;br /&gt;for(i=0;i&lt;n;i++)
&lt;br /&gt;{
&lt;br /&gt;term=(pow(x,i))/fact(i);
&lt;br /&gt;sum=sum+term;
&lt;br /&gt;}
&lt;br /&gt;printf("\nValue of sum is (i.e e(x)) : %f\n",sum);
&lt;br /&gt;}
&lt;br /&gt;int fact(int n)
&lt;br /&gt;{
&lt;br /&gt;int i,s=1;
&lt;br /&gt;for(i=1;i&lt;=n;i++)
&lt;br /&gt;s=s*i;
&lt;br /&gt;return s;
&lt;br /&gt;}&lt;/span&gt;
&lt;br /&gt;</content><link href="http://123bytes.blogspot.com/feeds/4340347114994399007/comments/default" rel="replies" title="Post Comments" type="application/atom+xml"/><link href="http://www.blogger.com/comment/fullpage/post/3930802340726048488/4340347114994399007" rel="replies" title="0 Comments" type="text/html"/><link href="http://www.blogger.com/feeds/3930802340726048488/posts/default/4340347114994399007" rel="edit" type="application/atom+xml"/><link href="http://www.blogger.com/feeds/3930802340726048488/posts/default/4340347114994399007" rel="self" type="application/atom+xml"/><link href="http://123bytes.blogspot.com/2009/04/e-series-calculation.html" rel="alternate" title="E-series calculation" type="text/html"/><author><name>Ganesh</name><uri>http://www.blogger.com/profile/02324863064543496197</uri><email>noreply@blogger.com</email><gd:image height="16" rel="http://schemas.google.com/g/2005#thumbnail" src="https://img1.blogblog.com/img/b16-rounded.gif" width="16"/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3930802340726048488.post-7363967420648765574</id><published>2009-04-13T05:29:00.000-07:00</published><updated>2009-04-13T05:30:35.887-07:00</updated><title type="text">EBBILL generation sample program</title><content type="html">
&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;#include&lt;iostream&gt;
&lt;br /&gt;using namespace std;
&lt;br /&gt;class ebbill
&lt;br /&gt;{
&lt;br /&gt;public:
&lt;br /&gt;int lread,cread,cmode,tread,diff;
&lt;br /&gt;float amt;
&lt;br /&gt;char cname[20],mode[];
&lt;br /&gt;//public:
&lt;br /&gt;void getdata();
&lt;br /&gt;float bill(int lread,int cread,int cmode);
&lt;br /&gt;void display();
&lt;br /&gt;/* ebbill()
&lt;br /&gt;{
&lt;br /&gt;lread=0;
&lt;br /&gt;cread=0;
&lt;br /&gt;cmode=0;
&lt;br /&gt;}
&lt;br /&gt;~ebbill()
&lt;br /&gt;{
&lt;br /&gt;lread=0;
&lt;br /&gt;cread=0;
&lt;br /&gt;cmode=0;
&lt;br /&gt;}*/
&lt;br /&gt;};
&lt;br /&gt;void ebbill::getdata()
&lt;br /&gt;{
&lt;br /&gt;//float amt;
&lt;br /&gt;//int diff;
&lt;br /&gt;cout&lt;&lt;"Enter the name of the customer : ";
&lt;br /&gt;cin&gt;&gt;cname;
&lt;br /&gt;cout&lt;&lt;"Enter the customer mode : "&lt;&lt;endl&lt;&lt;" 1.Home 2.Business 3.Industry"&lt;&lt;endl&lt;&lt;" Enter : ";
&lt;br /&gt;cin&gt;&gt;cmode;
&lt;br /&gt;get:
&lt;br /&gt;cout&lt;&lt;"Enter the last month reading : ";
&lt;br /&gt;cin&gt;&gt;lread;
&lt;br /&gt;cout&lt;&lt;"Enter the current month reading : ";
&lt;br /&gt;cin&gt;&gt;cread;
&lt;br /&gt;tread=cread-lread;
&lt;br /&gt;if (tread&lt;0)
&lt;br /&gt;{
&lt;br /&gt;cout&lt;&lt;"Enter the correct reading : ";
&lt;br /&gt;goto get;
&lt;br /&gt;}
&lt;br /&gt;diff=tread;
&lt;br /&gt;amt=bill(lread,cread,cmode);
&lt;br /&gt;display();
&lt;br /&gt;}
&lt;br /&gt;float ebbill::bill(int lread,int cread,int cmode)
&lt;br /&gt;{
&lt;br /&gt;float read=0.0;
&lt;br /&gt;switch(cmode)
&lt;br /&gt;{
&lt;br /&gt;case 1:
&lt;br /&gt;{
&lt;br /&gt;strcpy(mode,"Home");
&lt;br /&gt;if ((tread==0)(tread&lt;=100))
&lt;br /&gt;read=tread*0.4;
&lt;br /&gt;else if (tread&lt;=200)
&lt;br /&gt;{
&lt;br /&gt;tread=tread-100;
&lt;br /&gt;read=(tread*0.75)+40.00;
&lt;br /&gt;}
&lt;br /&gt;else if (tread&lt;=500)
&lt;br /&gt;{
&lt;br /&gt;tread=tread-200;
&lt;br /&gt;read=(tread*1.5)+(100.00*0.75)+40.00;
&lt;br /&gt;}
&lt;br /&gt;else
&lt;br /&gt;{
&lt;br /&gt;tread=tread-500;
&lt;br /&gt;read=(tread*2.0)+(300.0*1.5)+75.0+40.0;
&lt;br /&gt;}
&lt;br /&gt;break;
&lt;br /&gt;}
&lt;br /&gt;case 2:
&lt;br /&gt;{
&lt;br /&gt;strcpy(mode,"Business");
&lt;br /&gt;if ((tread==0)(tread&lt;=100))
&lt;br /&gt;read=tread*1.0;
&lt;br /&gt;else if (tread&lt;=500)
&lt;br /&gt;{
&lt;br /&gt;tread=tread-100;
&lt;br /&gt;read=(tread*2.0)+100.00;
&lt;br /&gt;}
&lt;br /&gt;else
&lt;br /&gt;{
&lt;br /&gt;tread=tread-500;
&lt;br /&gt;read=(tread*5.0)+(400.0*2.0)+100.0;
&lt;br /&gt;}
&lt;br /&gt;break;
&lt;br /&gt;}
&lt;br /&gt;case 3:
&lt;br /&gt;{
&lt;br /&gt;strcpy(mode,"Industry");
&lt;br /&gt;if ((tread==0)(tread&lt;=200))
&lt;br /&gt;read=tread*5.0;
&lt;br /&gt;else if (tread&lt;=1000)
&lt;br /&gt;{
&lt;br /&gt;tread=tread-200;
&lt;br /&gt;read=(tread*5.0)+500.00;
&lt;br /&gt;}
&lt;br /&gt;else
&lt;br /&gt;{
&lt;br /&gt;tread=tread-1000;
&lt;br /&gt;read=(tread*7.5)+(800.0*5.0)+500.0;
&lt;br /&gt;}
&lt;br /&gt;break;
&lt;br /&gt;}
&lt;br /&gt;}
&lt;br /&gt;return read;
&lt;br /&gt;}
&lt;br /&gt;void ebbill::display()
&lt;br /&gt;{
&lt;br /&gt;cout&lt;&lt;"Customer Name : "&lt;&lt;cname&lt;&lt;endl;
&lt;br /&gt;cout&lt;&lt;"Customer Mode : "&lt;&lt;cmode&lt;&lt;" "&lt;&lt;mode&lt;&lt;endl;
&lt;br /&gt;cout&lt;&lt;"Last month reading : "&lt;&lt;lread&lt;&lt;endl;
&lt;br /&gt;cout&lt;&lt;"Current month reading : "&lt;&lt;cread&lt;&lt;endl;
&lt;br /&gt;cout&lt;&lt;"Calculated Reading : "&lt;&lt;diff&lt;&lt;endl;
&lt;br /&gt;cout&lt;&lt;"Calculated Bill : "&lt;&lt;amt&lt;&lt;endl;
&lt;br /&gt;}
&lt;br /&gt;main()
&lt;br /&gt;{
&lt;br /&gt;system("clear");
&lt;br /&gt;ebbill eb;
&lt;br /&gt;eb.getdata();
&lt;br /&gt;return 0;
&lt;br /&gt;}&lt;/span&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link href="http://123bytes.blogspot.com/feeds/7363967420648765574/comments/default" rel="replies" title="Post Comments" type="application/atom+xml"/><link href="http://www.blogger.com/comment/fullpage/post/3930802340726048488/7363967420648765574" rel="replies" title="0 Comments" type="text/html"/><link href="http://www.blogger.com/feeds/3930802340726048488/posts/default/7363967420648765574" rel="edit" type="application/atom+xml"/><link href="http://www.blogger.com/feeds/3930802340726048488/posts/default/7363967420648765574" rel="self" type="application/atom+xml"/><link href="http://123bytes.blogspot.com/2009/04/ebbill-generation-sample-program.html" rel="alternate" title="EBBILL generation sample program" type="text/html"/><author><name>Ganesh</name><uri>http://www.blogger.com/profile/02324863064543496197</uri><email>noreply@blogger.com</email><gd:image height="16" rel="http://schemas.google.com/g/2005#thumbnail" src="https://img1.blogblog.com/img/b16-rounded.gif" width="16"/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3930802340726048488.post-8803592683917026456</id><published>2009-04-13T05:28:00.000-07:00</published><updated>2010-01-09T05:15:50.128-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Conceptial programs"/><title type="text">Cos series calculation</title><content type="html">
&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;#include&lt;stdio.h&gt;
&lt;br /&gt;#include "math.h"
&lt;br /&gt;int fact(int i);
&lt;br /&gt;main()
&lt;br /&gt;{
&lt;br /&gt;float x;
&lt;br /&gt;int n,i=1;
&lt;br /&gt;float term=0.0,sum=0.0,sign=-1;
&lt;br /&gt;printf("\nEnter the limit : ");
&lt;br /&gt;scanf("%d",&amp;amp;n);
&lt;br /&gt;printf("\nEnter the value of x : ");
&lt;br /&gt;scanf("%f",&amp;amp;x);
&lt;br /&gt;x=x*(3.14/180.0);
&lt;br /&gt;for(i=0;i&lt;n;i=i+2)
&lt;br /&gt;{
&lt;br /&gt;sign=-1*sign;
&lt;br /&gt;term=(sign*pow(x,i))/fact(i);
&lt;br /&gt;sum=sum+term;
&lt;br /&gt;}
&lt;br /&gt;printf("\nValue of sum is (i.e cos(x)) : %f\n",sum);
&lt;br /&gt;}
&lt;br /&gt;int fact(int n)
&lt;br /&gt;{
&lt;br /&gt;int i,s=1;
&lt;br /&gt;for(i=1;i&lt;=n;i++)
&lt;br /&gt;s=s*i;
&lt;br /&gt;return s;
&lt;br /&gt;}&lt;/span&gt;
&lt;br /&gt;</content><link href="http://123bytes.blogspot.com/feeds/8803592683917026456/comments/default" rel="replies" title="Post Comments" type="application/atom+xml"/><link href="http://www.blogger.com/comment/fullpage/post/3930802340726048488/8803592683917026456" rel="replies" title="0 Comments" type="text/html"/><link href="http://www.blogger.com/feeds/3930802340726048488/posts/default/8803592683917026456" rel="edit" type="application/atom+xml"/><link href="http://www.blogger.com/feeds/3930802340726048488/posts/default/8803592683917026456" rel="self" type="application/atom+xml"/><link href="http://123bytes.blogspot.com/2009/04/cos-series-calculation.html" rel="alternate" title="Cos series calculation" type="text/html"/><author><name>Ganesh</name><uri>http://www.blogger.com/profile/02324863064543496197</uri><email>noreply@blogger.com</email><gd:image height="16" rel="http://schemas.google.com/g/2005#thumbnail" src="https://img1.blogblog.com/img/b16-rounded.gif" width="16"/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3930802340726048488.post-8130472748345985072</id><published>2009-04-13T05:27:00.000-07:00</published><updated>2010-01-09T05:14:12.372-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Data Structures"/><title type="text">Circular queue implementation</title><content type="html">&lt;span style="font-family:trebuchet ms;"&gt;#include&lt;stdio.h&gt;&lt;br /&gt;#define max 5&lt;br /&gt;struct queue&lt;br /&gt;{&lt;br /&gt;int data[max],front,rear;&lt;br /&gt;};&lt;br /&gt;struct queue q;&lt;br /&gt;int isfull()&lt;br /&gt;{&lt;br /&gt;if((q.rear+2)%max==q.front)&lt;br /&gt;return 1;&lt;br /&gt;else&lt;br /&gt;return 0;&lt;br /&gt;}&lt;br /&gt;int isempty()&lt;br /&gt;{&lt;br /&gt;if ((q.rear+1)%max==q.front)&lt;br /&gt;return 1;&lt;br /&gt;else&lt;br /&gt;return 0;&lt;br /&gt;}&lt;br /&gt;void enqueue()&lt;br /&gt;{&lt;br /&gt;int val;&lt;br /&gt;if (isfull())&lt;br /&gt;printf("\nQueue is full!");&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;printf("\nEnter the value : ");&lt;br /&gt;scanf("%d",&amp;amp;val);&lt;br /&gt;q.rear=(q.rear+1)%max;&lt;br /&gt;q.data[q.rear]=val;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;int dequeue()&lt;br /&gt;{&lt;br /&gt;int x;&lt;br /&gt;if (isempty())&lt;br /&gt;printf("\nQueue is empty!");&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;x=q.data[q.front];&lt;br /&gt;q.front=(q.front+1)%max;&lt;br /&gt;return x;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;void display()&lt;br /&gt;{&lt;br /&gt;int i;&lt;br /&gt;if (isempty())&lt;br /&gt;printf("\nQueue is empty!");&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;printf("\nThe elements in the queue are...");&lt;br /&gt;for(i=q.front;i!=q.rear;i=(i+1)%max)&lt;br /&gt;printf("\n%d",q.data[i]);&lt;br /&gt;printf("\n%d",q.data[q.rear]);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;q.rear=-1;&lt;br /&gt;q.front=0;&lt;br /&gt;int choice;&lt;br /&gt;int isfull();&lt;br /&gt;int isempty();&lt;br /&gt;int dequeue();&lt;br /&gt;void enqueue();&lt;br /&gt;void display();&lt;br /&gt;printf("\n1-Insert 2-Delete 3-Display 4-Exit");&lt;br /&gt;do&lt;br /&gt;{&lt;br /&gt;printf("\nEnter your choice : ");&lt;br /&gt;scanf("%d",&amp;amp;choice);&lt;br /&gt;switch(choice)&lt;br /&gt;{&lt;br /&gt;case 1: enqueue(); break;&lt;br /&gt;case 2: printf("The deleted element is %d",dequeue()); break;&lt;br /&gt;case 3: display(); break;&lt;br /&gt;}&lt;br /&gt;}while(choice!=4);&lt;br /&gt;}&lt;/span&gt;</content><link href="http://123bytes.blogspot.com/feeds/8130472748345985072/comments/default" rel="replies" title="Post Comments" type="application/atom+xml"/><link href="http://www.blogger.com/comment/fullpage/post/3930802340726048488/8130472748345985072" rel="replies" title="0 Comments" type="text/html"/><link href="http://www.blogger.com/feeds/3930802340726048488/posts/default/8130472748345985072" rel="edit" type="application/atom+xml"/><link href="http://www.blogger.com/feeds/3930802340726048488/posts/default/8130472748345985072" rel="self" type="application/atom+xml"/><link href="http://123bytes.blogspot.com/2009/04/circular-queue-implementation.html" rel="alternate" title="Circular queue implementation" type="text/html"/><author><name>Ganesh</name><uri>http://www.blogger.com/profile/02324863064543496197</uri><email>noreply@blogger.com</email><gd:image height="16" rel="http://schemas.google.com/g/2005#thumbnail" src="https://img1.blogblog.com/img/b16-rounded.gif" width="16"/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3930802340726048488.post-4428195585792998211</id><published>2009-04-13T05:19:00.000-07:00</published><updated>2010-01-09T05:15:50.128-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Conceptial programs"/><title type="text">Bubble sort Program</title><content type="html">
&lt;br /&gt;
&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;#include&lt;stdio.h&gt;
&lt;br /&gt;main()
&lt;br /&gt;{
&lt;br /&gt;int a[10],n,i,pass;
&lt;br /&gt;system("clear");
&lt;br /&gt;printf("\nEnter the number of elements : ");
&lt;br /&gt;scanf("%d",&amp;amp;n);
&lt;br /&gt;printf("\nEnter the elements one by one...\n");
&lt;br /&gt;for(i=0;i&lt;n;i++)
&lt;br /&gt;scanf("%d",&amp;amp;a[i]);
&lt;br /&gt;printf("\nMaking the sorting of elements in Bubble Sort...\n");
&lt;br /&gt;for(pass=0;pass&lt;n-1;pass++)
&lt;br /&gt;for(i=0;i&lt;n-pass-1;i++)
&lt;br /&gt;if (a[i]&gt;a[i+1])
&lt;br /&gt;{
&lt;br /&gt;a[i]=a[i]+a[i+1];
&lt;br /&gt;a[i+1]=a[i]-a[i+1];
&lt;br /&gt;a[i]=a[i]-a[i+1];
&lt;br /&gt;}
&lt;br /&gt;printf("\nElements in the order after Bubble sort..\n");
&lt;br /&gt;for(i=0;i&lt;n;i++)
&lt;br /&gt;printf("%d\n",a[i]);
&lt;br /&gt;}&lt;/span&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link href="http://123bytes.blogspot.com/feeds/4428195585792998211/comments/default" rel="replies" title="Post Comments" type="application/atom+xml"/><link href="http://www.blogger.com/comment/fullpage/post/3930802340726048488/4428195585792998211" rel="replies" title="0 Comments" type="text/html"/><link href="http://www.blogger.com/feeds/3930802340726048488/posts/default/4428195585792998211" rel="edit" type="application/atom+xml"/><link href="http://www.blogger.com/feeds/3930802340726048488/posts/default/4428195585792998211" rel="self" type="application/atom+xml"/><link href="http://123bytes.blogspot.com/2009/04/bubble-sort-program.html" rel="alternate" title="Bubble sort Program" type="text/html"/><author><name>Ganesh</name><uri>http://www.blogger.com/profile/02324863064543496197</uri><email>noreply@blogger.com</email><gd:image height="16" rel="http://schemas.google.com/g/2005#thumbnail" src="https://img1.blogblog.com/img/b16-rounded.gif" width="16"/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3930802340726048488.post-2279227787684482626</id><published>2009-04-11T04:32:00.002-07:00</published><updated>2010-01-09T05:14:12.372-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Data Structures"/><title type="text">Data structures : single linked list program</title><content type="html">&lt;span style="font-family:trebuchet ms;"&gt;#include&lt;stdio.h&gt;&lt;br /&gt;struct node&lt;br /&gt;{&lt;br /&gt;int data;&lt;br /&gt;struct node *next;&lt;br /&gt;}*head,*temp1,*curr;&lt;br /&gt;void insert();&lt;br /&gt;void delete();&lt;br /&gt;void count();&lt;br /&gt;void display();&lt;br /&gt;void insert()&lt;br /&gt;{&lt;br /&gt;struct node *temp;&lt;br /&gt;int val;&lt;br /&gt;temp=(struct node *)malloc(sizeof(struct node));&lt;br /&gt;if (temp==NULL)&lt;br /&gt;{&lt;br /&gt;printf("\nMemory Full!");&lt;br /&gt;return;&lt;br /&gt;}&lt;br /&gt;printf("Enter the number : ");&lt;br /&gt;scanf("%d",&amp;amp;val);&lt;br /&gt;temp-&gt;data=val;&lt;br /&gt;temp-&gt;next=NULL;&lt;br /&gt;if (head==NULL)&lt;br /&gt;{&lt;br /&gt;head=temp;&lt;br /&gt;return;&lt;br /&gt;}&lt;br /&gt;if (head-&gt;next==NULL (head-&gt;next!=NULL &amp;amp;&amp;amp; temp-&gt;data &lt;&gt;data))&lt;br /&gt;{&lt;br /&gt;if (temp-&gt;data &lt;&gt;data)&lt;br /&gt;{&lt;br /&gt;temp-&gt;next=head;&lt;br /&gt;head=temp;&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;head-&gt;next=temp;&lt;br /&gt;return;&lt;br /&gt;}&lt;br /&gt;for(curr=head-&gt;next,temp1=head;curr!=NULL;curr=curr-&gt;next,temp1-temp1-&gt;next)&lt;br /&gt;{&lt;br /&gt;if (curr-&gt;data &gt; temp-&gt;data)&lt;br /&gt;{&lt;br /&gt;temp-&gt;next=curr;&lt;br /&gt;temp1-&gt;next=temp;&lt;br /&gt;return;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;temp1-&gt;next=temp;&lt;br /&gt;return;&lt;br /&gt;}&lt;br /&gt;void delete()&lt;br /&gt;{&lt;br /&gt;int x,found=0;&lt;br /&gt;struct node *temp;&lt;br /&gt;printf("Enter the node to delete : ");&lt;br /&gt;scanf("%d",&amp;amp;x);&lt;br /&gt;if (x==head-&gt;data)&lt;br /&gt;{&lt;br /&gt;temp=head;&lt;br /&gt;head=head-&gt;next;&lt;br /&gt;free(temp);&lt;br /&gt;found=1;&lt;br /&gt;return;&lt;br /&gt;}&lt;br /&gt;for(temp=head,curr=head-&gt;next;curr!=NULL;curr=curr-&gt;next,temp=temp-&gt;next)&lt;br /&gt;{&lt;br /&gt;if (curr-&gt;data==x &amp;amp;&amp;amp; found==0)&lt;br /&gt;{&lt;br /&gt;found=1;&lt;br /&gt;temp1=curr;&lt;br /&gt;if (curr-&gt;next==NULL)&lt;br /&gt;temp-&gt;next=NULL;&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;curr=curr-&gt;next;&lt;br /&gt;temp-&gt;next=curr;&lt;br /&gt;}&lt;br /&gt;free(temp1);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;if (!found)&lt;br /&gt;printf("\n Element not found!");&lt;br /&gt;}&lt;br /&gt;void count()&lt;br /&gt;{&lt;br /&gt;int c=0;&lt;br /&gt;struct node *temp;&lt;br /&gt;for(temp=head;temp!=NULL;temp=temp-&gt;next,c++);&lt;br /&gt;printf("\nNumber of nodes : %d",c);&lt;br /&gt;}&lt;br /&gt;void display()&lt;br /&gt;{&lt;br /&gt;struct node *temp;&lt;br /&gt;for(temp=head;temp!=NULL;temp=temp-&gt;next)&lt;br /&gt;printf("%d--&gt;",temp-&gt;data);&lt;br /&gt;}&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;int wish=1,choice;&lt;br /&gt;head=NULL;&lt;br /&gt;do&lt;br /&gt;{&lt;br /&gt;printf("\n1.Insert\n2.Delete\n3.Count\n4.Display\n5.Exit\n");&lt;br /&gt;printf("Enter Your choice : ");&lt;br /&gt;scanf("%d",&amp;amp;choice);&lt;br /&gt;switch(choice)&lt;br /&gt;{&lt;br /&gt;case 1: insert(); break;&lt;br /&gt;case 2: delete(); break;&lt;br /&gt;case 3: count(); break;&lt;br /&gt;case 4: display(); break;&lt;br /&gt;}&lt;br /&gt;}while(choice!=5);&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;</content><link href="http://123bytes.blogspot.com/feeds/2279227787684482626/comments/default" rel="replies" title="Post Comments" type="application/atom+xml"/><link href="http://www.blogger.com/comment/fullpage/post/3930802340726048488/2279227787684482626" rel="replies" title="0 Comments" type="text/html"/><link href="http://www.blogger.com/feeds/3930802340726048488/posts/default/2279227787684482626" rel="edit" type="application/atom+xml"/><link href="http://www.blogger.com/feeds/3930802340726048488/posts/default/2279227787684482626" rel="self" type="application/atom+xml"/><link href="http://123bytes.blogspot.com/2009/04/data-structures-single-linked-list.html" rel="alternate" title="Data structures : single linked list program" type="text/html"/><author><name>Ganesh</name><uri>http://www.blogger.com/profile/02324863064543496197</uri><email>noreply@blogger.com</email><gd:image height="16" rel="http://schemas.google.com/g/2005#thumbnail" src="https://img1.blogblog.com/img/b16-rounded.gif" width="16"/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3930802340726048488.post-9156180269357783873</id><published>2009-04-11T04:32:00.001-07:00</published><updated>2009-04-11T04:32:53.780-07:00</updated><title type="text">Sample employee payslip program</title><content type="html">&lt;span style="font-family:trebuchet ms;"&gt;#include&lt;stdio.h&gt;&lt;br /&gt;struct emp&lt;br /&gt;{&lt;br /&gt;double bp,hra,da,cca,ded,gp,np;&lt;br /&gt;char empname[20];&lt;br /&gt;};&lt;br /&gt;struct emp e[50];&lt;br /&gt;int i=0;&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;int ch;&lt;br /&gt;// struct emp e;&lt;br /&gt;int addemp();&lt;br /&gt;void display();&lt;br /&gt;int delemp();&lt;br /&gt;do&lt;br /&gt;{&lt;br /&gt;printf("\n1.Add 2.Delete 3.Display 4.Exit \nEnter the choice : ");&lt;br /&gt;scanf("%d",&amp;amp;ch);&lt;br /&gt;switch(ch)&lt;br /&gt;{&lt;br /&gt;case 1: i=addemp(); break;&lt;br /&gt;case 2: i=delemp(); break;&lt;br /&gt;case 3: display(); break;&lt;br /&gt;}&lt;br /&gt;}while(ch!=4);&lt;br /&gt;}&lt;br /&gt;int addemp()&lt;br /&gt;{&lt;br /&gt;i=i+1;&lt;br /&gt;e[i].ded=1000.00;&lt;br /&gt;printf("\nEnter the Employee Name : ");&lt;br /&gt;scanf("%s",e[i].empname);&lt;br /&gt;printf("\nEnter the Basic Pay : ");&lt;br /&gt;scanf("%lf",&amp;amp;e[i].bp);&lt;br /&gt;e[i].da=0.9*e[i].bp;&lt;br /&gt;e[i].hra=0.2*e[i].bp;&lt;br /&gt;e[i].cca=0.1*e[i].bp;&lt;br /&gt;e[i].gp=e[i].bp+e[i].da+e[i].hra+e[i].cca;&lt;br /&gt;e[i].np=e[i].gp-e[i].ded;&lt;br /&gt;return i;&lt;br /&gt;}&lt;br /&gt;int delemp()&lt;br /&gt;{&lt;br /&gt;printf("The deleted employee name is %s",e[i].empname);&lt;br /&gt;i=i-1;&lt;br /&gt;return i;&lt;br /&gt;}&lt;br /&gt;void display()&lt;br /&gt;{&lt;br /&gt;int j,k=0;&lt;br /&gt;printf("\t\t\t\tEMPLOYEE PAYSLIP\n\n");&lt;br /&gt;printf("\nSNO EMPLOYEE NAME BASIC DA HRA CCA GP DED NP\n");&lt;br /&gt;printf("--------------------------------------------------------------------------\n");&lt;br /&gt;for(j=1;j&lt;=i;j++)&lt;br /&gt;{&lt;br /&gt;k=k+1;&lt;br /&gt;printf("%3d %13s %7.2f %7.2f %7.2f %7.2f %8.2f %7.2f %8.2f",k,e[j].empname,e[j].bp,e[j].da,e[j].hra,e[j].cca,e[j].gp,e[j].ded,e[j].np);&lt;br /&gt;printf("\n");&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;}</content><link href="http://123bytes.blogspot.com/feeds/9156180269357783873/comments/default" rel="replies" title="Post Comments" type="application/atom+xml"/><link href="http://www.blogger.com/comment/fullpage/post/3930802340726048488/9156180269357783873" rel="replies" title="0 Comments" type="text/html"/><link href="http://www.blogger.com/feeds/3930802340726048488/posts/default/9156180269357783873" rel="edit" type="application/atom+xml"/><link href="http://www.blogger.com/feeds/3930802340726048488/posts/default/9156180269357783873" rel="self" type="application/atom+xml"/><link href="http://123bytes.blogspot.com/2009/04/sample-employee-payslip-program.html" rel="alternate" title="Sample employee payslip program" type="text/html"/><author><name>Ganesh</name><uri>http://www.blogger.com/profile/02324863064543496197</uri><email>noreply@blogger.com</email><gd:image height="16" rel="http://schemas.google.com/g/2005#thumbnail" src="https://img1.blogblog.com/img/b16-rounded.gif" width="16"/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3930802340726048488.post-4850957672905774469</id><published>2009-04-11T04:30:00.000-07:00</published><updated>2010-01-09T05:14:12.372-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Data Structures"/><title type="text">Data structures : Stack using pointers program</title><content type="html">&lt;span style="font-family:trebuchet ms;"&gt;#include&lt;stdio.h&gt;&lt;br /&gt;int pop();&lt;br /&gt;void push();&lt;br /&gt;int isempty();&lt;br /&gt;void display();&lt;br /&gt;struct node&lt;br /&gt;{&lt;br /&gt;int data;&lt;br /&gt;struct node *next;&lt;br /&gt;};&lt;br /&gt;struct node *temp;&lt;br /&gt;struct node *top=NULL;&lt;br /&gt;void push()&lt;br /&gt;{&lt;br /&gt;int value;&lt;br /&gt;printf("\nEnter the value : ");&lt;br /&gt;scanf("%d",&amp;amp;value);&lt;br /&gt;temp=(struct node *)malloc(sizeof(struct node));&lt;br /&gt;if (temp==NULL)&lt;br /&gt;printf("\nMemory is not available!");&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;temp-&gt;data=value;&lt;br /&gt;if (top==NULL)&lt;br /&gt;temp-&gt;next=NULL;&lt;br /&gt;else&lt;br /&gt;temp-&gt;next=top;&lt;br /&gt;top=temp;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;int pop()&lt;br /&gt;{&lt;br /&gt;struct node *temp;&lt;br /&gt;int value;&lt;br /&gt;if (isempty())&lt;br /&gt;printf("\nStack is empty!");&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;temp=top;&lt;br /&gt;value=temp-&gt;data;&lt;br /&gt;top=top-&gt;next;&lt;br /&gt;free(temp);&lt;br /&gt;return value;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;int isempty()&lt;br /&gt;{&lt;br /&gt;if (top==NULL)&lt;br /&gt;return 1;&lt;br /&gt;else&lt;br /&gt;return 0;&lt;br /&gt;}&lt;br /&gt;void display()&lt;br /&gt;{&lt;br /&gt;struct node *temp;&lt;br /&gt;if (isempty())&lt;br /&gt;printf("\nStack is empty!");&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;printf("The elements in the stack are...\n");&lt;br /&gt;for(temp=top;temp!=NULL;temp=temp-&gt;next)&lt;br /&gt;printf("%d\n",temp-&gt;data);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;int ch;&lt;br /&gt;printf("\n1.Push 2.Pop 3.Display 4.Exit\n");&lt;br /&gt;do&lt;br /&gt;{&lt;br /&gt;printf("\nEnter your choice : ");&lt;br /&gt;scanf("%d",&amp;amp;ch);&lt;br /&gt;switch(ch)&lt;br /&gt;{&lt;br /&gt;case 1: push(); break;&lt;br /&gt;case 2: printf("\nDeleted element is %d",pop()); break;&lt;br /&gt;case 3: display(); break;&lt;br /&gt;}&lt;br /&gt;}while(ch!=4);&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;</content><link href="http://123bytes.blogspot.com/feeds/4850957672905774469/comments/default" rel="replies" title="Post Comments" type="application/atom+xml"/><link href="http://www.blogger.com/comment/fullpage/post/3930802340726048488/4850957672905774469" rel="replies" title="0 Comments" type="text/html"/><link href="http://www.blogger.com/feeds/3930802340726048488/posts/default/4850957672905774469" rel="edit" type="application/atom+xml"/><link href="http://www.blogger.com/feeds/3930802340726048488/posts/default/4850957672905774469" rel="self" type="application/atom+xml"/><link href="http://123bytes.blogspot.com/2009/04/data-structures-stack-using-pointers.html" rel="alternate" title="Data structures : Stack using pointers program" type="text/html"/><author><name>Ganesh</name><uri>http://www.blogger.com/profile/02324863064543496197</uri><email>noreply@blogger.com</email><gd:image height="16" rel="http://schemas.google.com/g/2005#thumbnail" src="https://img1.blogblog.com/img/b16-rounded.gif" width="16"/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3930802340726048488.post-4913425864573339992</id><published>2009-04-11T04:27:00.000-07:00</published><updated>2010-01-09T05:14:12.372-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Data Structures"/><title type="text">Data structures : Stack using array program</title><content type="html">&lt;span style="font-family:trebuchet ms;"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;strong&gt;&lt;span style="font-size:78%;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:trebuchet ms;"&gt;#include&lt;stdio.h&gt;
&lt;br /&gt;#define max 10
&lt;br /&gt;struct stack
&lt;br /&gt;{
&lt;br /&gt;int data[max];
&lt;br /&gt;int top;
&lt;br /&gt;};
&lt;br /&gt;struct stack s;
&lt;br /&gt;main()
&lt;br /&gt;{
&lt;br /&gt;s.top=-1;
&lt;br /&gt;int choice;
&lt;br /&gt;int isfull();
&lt;br /&gt;int isempty();
&lt;br /&gt;void push();
&lt;br /&gt;int pop();
&lt;br /&gt;void display();
&lt;br /&gt;do
&lt;br /&gt;{
&lt;br /&gt;printf("\n1-Add element 2-Delete element 3-Display element 4-Exit\nEnter your choice : ");
&lt;br /&gt;scanf("%d",&amp;amp;choice);
&lt;br /&gt;switch(choice)
&lt;br /&gt;{
&lt;br /&gt;case 1: push(); break;
&lt;br /&gt;case 2: printf("\nThe deleted element is %d",pop()); break;
&lt;br /&gt;case 3: display();
&lt;br /&gt;}
&lt;br /&gt;}while(choice!=4);
&lt;br /&gt;}
&lt;br /&gt;int isempty()
&lt;br /&gt;{
&lt;br /&gt;if(s.top==-1)
&lt;br /&gt;return 1;
&lt;br /&gt;else
&lt;br /&gt;return 0;
&lt;br /&gt;}
&lt;br /&gt;int isfull()
&lt;br /&gt;{
&lt;br /&gt;if(s.top==max-1)
&lt;br /&gt;return 1;
&lt;br /&gt;else
&lt;br /&gt;return 0;
&lt;br /&gt;}
&lt;br /&gt;void push()
&lt;br /&gt;{
&lt;br /&gt;int value;
&lt;br /&gt;printf("\nEnter the value... ");
&lt;br /&gt;scanf("%d",&amp;amp;value);
&lt;br /&gt;if(s.top&lt;max)
&lt;br /&gt;{
&lt;br /&gt;s.top+=1;
&lt;br /&gt;s.data[s.top]=value;
&lt;br /&gt;printf("\n# Value Inserted #");
&lt;br /&gt;}
&lt;br /&gt;else
&lt;br /&gt;printf("\nStack Overflow!");
&lt;br /&gt;}
&lt;br /&gt;int pop()
&lt;br /&gt;{
&lt;br /&gt;int x;
&lt;br /&gt;if (isempty())
&lt;br /&gt;{
&lt;br /&gt;printf("\nStack empty!");
&lt;br /&gt;return -1;
&lt;br /&gt;}
&lt;br /&gt;else
&lt;br /&gt;{
&lt;br /&gt;x=s.data[s.top];
&lt;br /&gt;s.top-=1;
&lt;br /&gt;return x;
&lt;br /&gt;}
&lt;br /&gt;}
&lt;br /&gt;void display()
&lt;br /&gt;{
&lt;br /&gt;int i;
&lt;br /&gt;if (isempty())
&lt;br /&gt;printf("\nStack is empty!");
&lt;br /&gt;else
&lt;br /&gt;{
&lt;br /&gt;printf("The elements in the stack are...\n");
&lt;br /&gt;for(i=0;i&lt;=s.top;i++)
&lt;br /&gt;printf("%d\n",s.data[i]);
&lt;br /&gt;printf("\nThe number of elements in the stack are %d",i);
&lt;br /&gt;}
&lt;br /&gt;}&lt;/span&gt;
&lt;br /&gt;&lt;/span&gt; &lt;/span&gt;&lt;/strong&gt;
&lt;br /&gt;</content><link href="http://123bytes.blogspot.com/feeds/4913425864573339992/comments/default" rel="replies" title="Post Comments" type="application/atom+xml"/><link href="http://www.blogger.com/comment/fullpage/post/3930802340726048488/4913425864573339992" rel="replies" title="0 Comments" type="text/html"/><link href="http://www.blogger.com/feeds/3930802340726048488/posts/default/4913425864573339992" rel="edit" type="application/atom+xml"/><link href="http://www.blogger.com/feeds/3930802340726048488/posts/default/4913425864573339992" rel="self" type="application/atom+xml"/><link href="http://123bytes.blogspot.com/2009/04/data-structures-stack-using-array.html" rel="alternate" title="Data structures : Stack using array program" type="text/html"/><author><name>Ganesh</name><uri>http://www.blogger.com/profile/02324863064543496197</uri><email>noreply@blogger.com</email><gd:image height="16" rel="http://schemas.google.com/g/2005#thumbnail" src="https://img1.blogblog.com/img/b16-rounded.gif" width="16"/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3930802340726048488.post-8370500238214657494</id><published>2009-04-11T04:24:00.000-07:00</published><updated>2010-01-09T05:14:12.373-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Data Structures"/><title type="text">Data structures : Queue using array program </title><content type="html">
&lt;br /&gt;
&lt;br /&gt;#include&lt;stdio.h&gt;
&lt;br /&gt;#define max 10
&lt;br /&gt;
&lt;br /&gt;struct queue
&lt;br /&gt;{
&lt;br /&gt; int front,rear,data[max];
&lt;br /&gt;};
&lt;br /&gt;struct queue q;
&lt;br /&gt;
&lt;br /&gt;main()
&lt;br /&gt;{
&lt;br /&gt; int ch;
&lt;br /&gt;q.front=0;
&lt;br /&gt;q.rear=-1;
&lt;br /&gt; int isempty();
&lt;br /&gt; void display();
&lt;br /&gt; void enqueue();
&lt;br /&gt; void count();
&lt;br /&gt; int isfull();
&lt;br /&gt; int dequeue();
&lt;br /&gt; do
&lt;br /&gt;{
&lt;br /&gt; printf("\n1-Add 2-Delete 3-Display 4-Count 5-Exit\nEnter ur choice : ");
&lt;br /&gt; scanf("%d",&amp;ch);
&lt;br /&gt; switch(ch)
&lt;br /&gt;{
&lt;br /&gt; case 1: enqueue(); break;
&lt;br /&gt; case 2: printf("\nThe deleted element is %d",dequeue()); break;
&lt;br /&gt; case 3: display(); break;
&lt;br /&gt; case 4: count(); break;
&lt;br /&gt;}
&lt;br /&gt;}while(ch!=5);
&lt;br /&gt;}
&lt;br /&gt;
&lt;br /&gt;int isfull()
&lt;br /&gt;{
&lt;br /&gt; if (q.rear==max-1)
&lt;br /&gt;  return 1;
&lt;br /&gt; else
&lt;br /&gt;  return 0;
&lt;br /&gt;}
&lt;br /&gt;
&lt;br /&gt;int isempty()
&lt;br /&gt;{
&lt;br /&gt; if (q.rear&lt;q.front)
&lt;br /&gt;  return 1;
&lt;br /&gt; else
&lt;br /&gt;  return 0;
&lt;br /&gt;}
&lt;br /&gt;
&lt;br /&gt;void count()
&lt;br /&gt;{
&lt;br /&gt; printf("\nThe number of elements in the queue are %d",q.rear-q.front+1);
&lt;br /&gt;}
&lt;br /&gt;
&lt;br /&gt;void enqueue()
&lt;br /&gt;{
&lt;br /&gt; int val;
&lt;br /&gt; if (isfull())
&lt;br /&gt;  printf("\nQueue is full!");
&lt;br /&gt; else
&lt;br /&gt; {
&lt;br /&gt; printf("\nEnter the element... ");
&lt;br /&gt; scanf("%d",&amp;val);
&lt;br /&gt; q.rear+=1;
&lt;br /&gt; q.data[q.rear]=val;
&lt;br /&gt; }
&lt;br /&gt;}
&lt;br /&gt;
&lt;br /&gt;int dequeue()
&lt;br /&gt;{
&lt;br /&gt; int x;
&lt;br /&gt; if (isempty())
&lt;br /&gt;  printf("\nQueue is empty!");
&lt;br /&gt; else
&lt;br /&gt; {
&lt;br /&gt; x=q.data[q.front];
&lt;br /&gt; q.front+=1;
&lt;br /&gt; return x;
&lt;br /&gt; }
&lt;br /&gt;}
&lt;br /&gt;
&lt;br /&gt;void display()
&lt;br /&gt;{
&lt;br /&gt; int i;
&lt;br /&gt; printf("\nThe elements in the queue are...\n");
&lt;br /&gt; for(i=q.front;i&lt;=q.rear;i++)
&lt;br /&gt; printf("%d\n",q.data[i]);
&lt;br /&gt;}
&lt;br /&gt;
&lt;br /&gt;</content><link href="http://123bytes.blogspot.com/feeds/8370500238214657494/comments/default" rel="replies" title="Post Comments" type="application/atom+xml"/><link href="http://www.blogger.com/comment/fullpage/post/3930802340726048488/8370500238214657494" rel="replies" title="0 Comments" type="text/html"/><link href="http://www.blogger.com/feeds/3930802340726048488/posts/default/8370500238214657494" rel="edit" type="application/atom+xml"/><link href="http://www.blogger.com/feeds/3930802340726048488/posts/default/8370500238214657494" rel="self" type="application/atom+xml"/><link href="http://123bytes.blogspot.com/2009/04/data-structures-queue-using-array.html" rel="alternate" title="Data structures : Queue using array program " type="text/html"/><author><name>Ganesh</name><uri>http://www.blogger.com/profile/02324863064543496197</uri><email>noreply@blogger.com</email><gd:image height="16" rel="http://schemas.google.com/g/2005#thumbnail" src="https://img1.blogblog.com/img/b16-rounded.gif" width="16"/></author><thr:total>0</thr:total></entry></feed>