array insertion
void insert(float a[], int n, float x); void print(float a[],int n); int main() { float m; float a[8]= {22,33,44,55,66,77,88,99}; cout<<"The given array is: "<<endl; for(int i=0; i<8; i++) { cout<<a[i]<<","; } cout<<"\n Enter the value inserted into the array: "; cin>>m; insert(a,8,m); } void insert(float a[], int n, float x) { int j=n; while( j>0 && a[j-1]>x) { a[j--] = a[j-1]; a[j] = x; } ++n; cout<<"After inserting,the array: "<<endl; print(a,n+1); } void print(float a[],int n) { for(int i=0; i<n; i++) { cout<<a[i]<<","; } } the code works fine but how can I remove that 0 at last?