problem . in c++ code . insertion- search

hi ..
i codded in c++
but i have many errors .
i'am until now sudy c++ by myself .
if you can help me to explain my errors in my code . i will be soo thanks .

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include<iostream.h>
int  search (int a[],int n,int k);
void insert(int a[],int &n,int x,int k);
void main()
{
	int a[1000];
	int arraysize;
int searchkey;
cout<<"Enter how many elements in your array";
cin>>arraysize;
cout<<"enter the elements of the array ";
for(int i=0;i<arraysize;i++)
cin>>a[i];
cout<<"Enter the searchkey";
cin>>searchkey;
search( a,arraysize,searchkey);
insert(a,arraysize,searchkey,i);

}
int search(int a[], int k ,int n){
int index=-1;
for(int i=0;i<n;i++)
if (a[i]==k)
index =i;
return index;
}
void insert (int a[],int &n,int k,int x)
{
	int i=search(a,n,k);
	if ( i<0)
		cout<<"THERE IS  such item with value k \n";
	else 
	{
		insert (x,i,a,n);
	}
}




My code should be insert element after specific value >
like insert 6 after 7
i know i should first search about 6 if its there good
and return its index .
and function to insrt value ..


thanks for all >
i'am until now sudy c++ by myself


Actually That statment is incorrect becuase "I'm" is the same as "I am" so I have yet to see how "I'am" actually makes any sense...

That and "main" has to return an "Int"


//TOO MANY QUOTATION MARKS!!!!
Topic archived. No new replies allowed.