Redesign the functions the read andor move functions so that

Re-design the functions (the read and/or move functions) so that the main function calls the read function, and the read function makes use of the move function to read and store numbers as long as the user inputs a positive number.

Solution

Modifying main function as follows:

while (!read(p, &csz, cap, inc){

    cout<<\"There is more to read ... moving... \ \";

    cap = cap+inc;

    cout<<\"done moving... \ \";

}

Modify read function as follows:

bool read (int* p, int* csz, int cap, int inc){

    int temp = 0;

    if (*csz>=cap)

        return false;

    for (int i=*csz; i=cap; i++){

        cin>>temp;

        if (temp<0)

            move (p, cap, inc);

            return true;

        p[i]=temp;

        (*csz) ++;

    }

    return false;

}

 Re-design the functions (the read and/or move functions) so that the main function calls the read function, and the read function makes use of the move functio

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site