Programming Ideas

Monthly Archives: June 2012

This application can be used for Beginner HTML Script to Advanced HTML Script. It won’t do much, it will highlight the tag and other stuffs. You can use it for testing someone HTML Skill and also just to try it out. You can also preview the code into webpage live, etc. This application is absolutely free and there’s no guaranteed that this software is fit for merchant and other business purpose. As you use the software, you agreed that there’s no warranted stuff.

This is the second release (stand alone version)

There is also a small fix.

Screen shot

 

DOWNLOAD IT

Let’s start right from the simple program again. It may be helpful for those who start off Java Programming.

You will find lots of simple program but you may already forgot them too! Check it out.

//Program to retrieve IP Address of a given Host / Local Host
import java.net.*;
public class IPAdd
{
    public static void main(String ar[]) throws UnknownHostException
    {
        InetAddress hostName;
        byte bytes[];
        int fourBytes[] = new int[4];
        if(ar.length == 0)
        {
           hostName = InetAddress.getLocalHost();           
        }
        else
        {
            hostName = InetAddress.getByName(ar[0]);
        }
        System.out.print(someHost.getHostName()+" has address : ");
        bytes = hostName.getAddress();
        for(int i=0;i<4;i++)
        {
            fourBytes[i] = bytes[i] & 255;
        }

      System.out.println(fourBytes[0]+"."+fourBytes[1]+"."+fourBytes[2]+"."+fourBytes[3]);
    }
}

There are lots more program here. I found them out when I check out my old HDD. So I would like to share them with you. I did this program when I was doing BCA (Bachelor of Computer Application). Continue reading

Bubble sort

#include<iostream>
#include<conio.h>
using namespace std;
int bubblesort(int[],int);
int main()
{
    int i,AR[50],N;
    cout<<"How many elements do U want to create with?(max.50):";
    cin>>N;
    cout<<"\n Enter array elements:\n";
    for(i=0;i<N;i++)
    cin>>AR[i];
    bubblesort(AR,N);
    cout<<"\n\nThe sorted array is as shown below:\n";
    for(i=0;i<N;i++)
    {
    cout<<AR[i]<<" ";
}
    cout<<endl;
    getch();
}
int bubblesort(int AR[],int size)
{
    int tmp,ctr=0;
    for(int i=0;i<size;i++)
    {
            for(int j=0;j<(size-1);j++)
            {
                    if(AR[j]>AR[j+1])
                    {
                                     tmp=AR[j];
                                     AR[j]=AR[j+1];
                                     AR[j+1]=tmp;
                    }
            }
            cout<<"Array after iteration-"<<++ctr<<"-is: ";
            for(int k=0;k<size;k++)
            cout<<AR[k]<<" ";
            cout<<endl;
    }
    getch();
    return 0;
}

This is C++ Program to demonstrate how to delete  element in Array without changing the order of the Array.

The element to be deleted is first searched for in the array using one of the search techniques i.e. either linear search or binary search. If the search is successful, the element is removed and rest of the elements are shifted so as to keep the array undisturbed.

 

Written by- Arindam Roy. Continue reading

This is C++ Program to demonstrate how to insert element in Array without changing the order of the Array.

Traversal in One-Dimensional Arrays involves processing of all elements(i.e. from every first to last element)

It would process in the following order:

X[0],X[1],X[2],X[3],……..

 

THE FOLLOWING PROGRAM TELLS US  THAT HOW A STRUCTURE POINTER IS USEFUL. THE PROGRAM TELLS US HOW TO INVOKE A FUNCTION BY PASSING A STRUCTURE POINTER TO IT. THE CALLED FUNCTION CHANGES THE ORIGINAL VALUE OF A STRUCTURE ELEMENT DEPENDING UPON A CONDITION.

Written by: Pawan Kumar Sharma

 

#include<iostream>
#include<conio.h>
#include<string.h>
#include<stdio.h>
using namespace std;
int main()
struct Employee
{
      int empno;
      char name[26];
      float basic;
      float experience;
};
      void display(Employee*emp);
      void increase(Employee*emp);
      void main()
{
      Employee mgr, *eptr;
      cout<<"Enter employee number:";   cin>>mgr.empno;
      cout<<"Enter name:";              gets(mgr.name);
      cout<<"Enter basic pay:";         cin>>mgr.basic;
      cout<<"Enter experience(in years):"; cin>>mgr.experience;
      eptr=&mgr;
      cout<<"\nEmployee Details after increase()\n";
      display(eptr);
      increase(eptr);// Increase the basic if eligible
      cout<<"\nEmployee Details after increase() \n";
      display(eptr);
}
void display(Employee*emp)
{
   int len= strlen(emp->name);
   cout<<"Employee number:"<<emp->empno;
   cout<<"\nName:";  cout.write(emp->name,len);
   cout<<"\tExperience:"<<emp->experience<<"years\n";
}
 void increase(Employee*emp)
{
  if(emp->experience>=10)
       emp->basic+=200;
}

Freind’s let’s learn how  to sort the elements of an array.See how to arrange  elements of an array in systematic manner.In this program i have written the ways how to sort elements of an array.

Written By: Vivek Sharma

#include<iostream>
#include<conio.h>
#include"swap.h"
using namespace std;

int main()
{
    int a[10],h,t,i;

    cout<<"Enter 10 numbers: ";

    for(i=0;i<10;i++)
    {
        cout<<endl<<i+1<<":";
        cin>>a[i];
    }
    cout<<"\nUnsorted Array \n ";
    for(i=0;i<10;i++)
    {

        cout<<a[i]<<" ";
    }
    h=0;
    t=h+1;
    for(i=0;i<10;i++)
    {
       if(t<10)
       { 
          if(a[h]>a[t])
          {
             swap(a[h],a[t]);
          }

          t++;
       }
       else
       {
           if(h==t-1)
           {
              break;
           }
           else
           {

               h++;
               i=0;
               t=h+1;
           }
       }
    }
    cout<<"\n Sorted Array\n ";
    for(i=0;i<10;i++)
    {
        cout<<a[i]<<" ";
    }
    getch();
    return 0;
}

This is C++ Program to demonstrate how to insert element in Array without changing the order of the Array.

For insertion in these type of arrays, we need to have two information, the element to be inserted and the position to which it will be inserted.
Insertion of new element in Array can be done in two ways:
(i). If the array is unordered the element is inserted at the end of the Array.
(ii). If the Array is sorted then new element is added at appropriate position without alternating there order.

 

Continue reading

Link Exchange
Advertisement
Get one year License for Avast FREE ! Go to Avast Official Site to download and get the License
About Me
I am a Master of Computer Application (MCA) degree holder. I am also qualified UGC-NET Lecturership in Computer Science & Application.

I am available for Freelancing.

Expert in :
  1. C# Programming (Desktop & Web)
  2. VB.NET Programming (Desktop & Web)
  3. PHP Web Designing + CSS3
  4. SQL Administration
  5. Ethical Hacking
Site Estimated Cost
zosoftnet.com website worth badge