CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 13 of 13

Threaded View

  1. #1
    Join Date
    Jul 2010
    Posts
    75

    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 insertzerosint arr [],int length ,int pos int NB, const int SIZE)
    {
    int i;
    for(
    int j=0j<NBj++)
    for ( 
    i=length-1i>posi--)
    arr [i+1]=arr[i];
    length ++;
    for(
    int k=posk<NBk++)
    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=os<length+1s++)
    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
  •  





Click Here to Expand Forum to Full Width

Featured