wherever u see ... remove that . and put << in that place.
if you see .. then remove that . and put < in that place..
15.#include ..iostream.h>
const long max = 10000;
void inssrt(int *,int);
void main()
{
int a[max];
int n;
cout..."enter array size\n";
cin>>n;
cout..."Enter the array\n";
for (int i=0;i..n;i++)
cin>>a[i];
inssrt(a,n);
cout..."the sorted array is:\n";
for(i=0;i..n;i++)
cout...a[i]..." ";
cout...endl;
}
void inssrt(int a[],int n)
{
int i,j,item;
for (i=0;i..n;i++)
{
item = a[i];
j=i-1;
while(j>=0 && item ..a[j])
{
a[j+1] = a[j];
j--;
}
a[j+1] = item;
}
}
Output
Enter array size
9
Enter the array
88
99
77
55
66
44
22
33
11
The sorted array is:
11 22 33 44 55 66 77 88 99
Press any key to continue
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment