|
-
October 2nd, 2010, 02:50 AM
#1
Need Help With The Array
hello guys can u tell me how i will solve this question with array
i answer it but i guess there is alot of problems and it doesnt work ,
THE QUESTION IS
==============
Write a function named insertzeros that takes as parameters : an array of integers , number of elements in the array which is passed by reference , a position in the array pos , an integer NB ( the number of zeros to be inserted ) , and a constant array SIZE ( maximum size ) . The function should insert NB zeros starting from pos.
the function prototype is :
void insertzeros ( int arr [], int & length , int pos , int NB , const int SIZE );
==============
PHP Code:
# include <iostream> using namespace std; void insertzeros( int arr [],int & length ,int pos , int NB, const int SIZE) { int i; for(int j=0; j<NB; j++) for ( i=length-1; i>pos; i--) arr [i+1]=arr[i]; length ++; for(int k=pos; k<NB; k++) arr [k]=0; int main () { int NB,pos,arr; cout << " Enter The Number Of Zeros " <<endl; cin >>NB; cout << " Enter The Position " <<endl; cin >>pos; cout << " Enter The Array Size "<<endl; for (int s=o; s<length+1; s++) cin>>arr[];
}
Last edited by jacksparrow; October 2nd, 2010 at 08:01 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|