When i try to compile it i get error messages about the insert() function as

commented below. Could someone explain what is wrong? If so thanks.

Here is test driver and offending function text code:

Expand|Select|Wrap|Line Numbers

- #include<iostream>
- using namespace std;
- void print(float x[],int n);
- void insert(float x[],int n,float t);//doesn`t work
- int main()
- {
- cout<<"\nInserts a value into a sorted array\n";
- float x[8]={22.3,33.4,44.5,66.7,77.8};
- cout<<"Array x [] is: ";
- print(x,5);
- insert(x,4,55.6);
- cout<<"\n\n";
- system("pause");
- return 0;
- }
- void print(float x[],int n)
- {
- for(int i=0;i<n;i++)
- cout<<x[i]<<" ";
- }
- void insert(float x[],int n,float t)//this is not my work now; it is the published solution.
- {
- for(int i = n;i>0 && x[i-1]> t;i--)//using obsolete binding at 'i'
- x[i]=x[i-1];
- x[i]= t;//name lookup of i changed for new ISO 'for' scoping
- }