I/O Interfaces, IEEE 1394, Parallel to SCSI Converter, Testing Serial Ports
Click here to download it
By Er Gurpreet Singh,
Senior Software Engineer,
Sopra Steria India
<div style="overflow-x: scroll; width: 300px;">
In HTML, span and div elements are used to define parts of a document so that they are identifiable when no other HTML element is suitable.
<div>
<div style="overflow-y: scroll; height: 300px;">
In HTML,
span and div elements are used
to define parts of a document
so that they are identifiable
when no other HTML element is suitable.
<div>
<div style="overflow: scroll; height: 300px; width:400px;">
In HTML,
span and div elements are used
to define parts of a document
so that they are identifiable
when no other HTML element is suitable.
<div>
import java.applet.*;
import java.awt.*;
public class Demo1 extends Applet
{
public void init()
{
//Code to run automatically
this.setSize(500, 500);
this.setBackground(Color.CYAN);
}
public void paint(Graphics g)
{
//now draw graphics
g.drawLine(0, 0, 100, 100);
g.drawRect(0, 0, 100, 100);
//change color of graphics
g.setColor(Color.blue);
g.drawString("Applet Demo", 0, 120);
}
}
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int n,*a,item,loc=-1;
cout<<"\nenter the no. of elements :";
cin>>n;
a=new int[n]; //dynamically initialize array
cout<<"\nenter the elements:\n";
for(int i=0;i<n;i++)
cin>>a[i];
cout<<"\nenter the element you want to search: ";
cin>>item;
int mid,end=n,beg=0;
while(beg<=end&&loc==-1)
{
mid=(beg+end)/2;
if(a[mid]==item)
loc=mid;
else if(a[mid]<item)
beg=mid+1;
else
end=mid-1;
}
if(loc!=-1)
cout<<"\nlocation of "<<item<<" is:"<<loc+1;
else
cout<<"\n"<<item<<" not found!!!";
getch();
}
#include<iostream.h>
#include<conio.h>
void main()
{ clrscr();
int *a,n,loc=-1,item;
cout<<"\nenter the no. of elements (max. 10):";
cin>>n;
a=new int[n]; //dynamically initialize array
cout<<"\nenter the elements:\n";
for(int i=0;i<n;i++)
cin>>a[i];
cout<<"\nenter the element to be searched: ";
cin>>item;
for(i=0;i<n;i++)
if(a[i]==item)
{ loc=i;
break;
}
if(loc==-1)
cout<<"\n"<<item<<" not found!!!";
else
cout<<"location of "<<item<<" is: "<<loc+1;
getch();
}
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int n,temp,min;
cout<<"\nEnter the no. of elements you want:";
cin>>n;
int *a=new int[n]; //dynamically initialize array
cout<<"\nEnter the elements:\n";
for(int i=0;i<n;i++)
cin>>a[i];
for(i=0;i<n;i++)
{
min=i;
for(int j=i+1;j<n;j++)
{
If(a[min]>a[j])
min=j;
}
temp=a[min];
a[min]=a[i];
a[i]=temp;
}
cout<<"\nSorted list of given integers is(in ascending order) :\n";
for(i=0;i<n;i++)
cout<<a[i]<<" ";
getch();
}
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int n,temp;
cout<<"\nEnter the no. of elements you want:";
cin>>n;
int *a=new int[n]; //dynamically initialize array
cout<<"\nEnter the elements:\n";
for(int i=0;i<n;i++)
cin>>a[i];
for(i=0;i<n;i++)
{
for(int j=0;j<n-i-1;j++)
{
if(a[j]>a[j+1])
{
temp=a[j];
a[j]=a[j+1];
a[j+1]=temp;
}
}
}
cout<<"\nSorted list of given integers is(in ascending order) :\n";
for(i=0;i<n;i++)
cout<<a[i]<<" ";
getch();
}
#include<iostream.h>
#include<conio.h>
#include<values.h>
void merge(int a[],int p,int q,int r)
{
int n1=q-p+1,n2=r-q;
int *l=new int[n1+1];
int *rt=new int[n2+1];
for(int i=0;i<n1;i++)
l[i]=a[p+i];
for(int j=0;j<n2;j++)
rt[j]=a[q+j+1];
l[n1]=MAXINT; //SENTINEL
rt[n2]=MAXINT; //SENTINEL
i=j=0;
for(int k=p;k<=r;k++)
{
if(l[i]<=rt[j])
{
a[k]=l[i];
i+=1;
}
else
{
a[k]=rt[j];
j+=1;
}
}
}
void mergesort(int a[],int p,int r)
{
int q;
if(p<r)
{
q=(p+r)/2;
mergesort(a,p,q);
mergesort(a,q+1,r);
merge(a,p,q,r);
}
}
void main()
{
clrscr();
int n;
cout<<"\nEnter the no. of elements you want:";
cin>>n;
int *a=new int[n]; //dynamically initialize array
cout<<"\nEnter the elements:\n";
for(int i=0;i<n;i++)
cin>>a[i];
mergesort(a,0,n-1);
cout<<"\n\nSORTED ARRAY IS:\n";
for( i=0;i<n;i++)
cout<<a[i]<<" ";
getch();
}