Menu

[solved]-Using C Implement Two Functions Specified Listh Need Fill Implementation Listcpp Bool Inse Q39037302

Using C++, implement the two functions specified in list.h. Youneed to fill in the implementation in list.cpp

bool insert(int position, int val, int intList[],int& size)

This function will insert “val” at “position” of “intList” andincrement size

bool remove (int position, int& val, int intList[],int& size)

This function will remove the integer at “position” from”intList” and return the value through “val”, and decrementsize.

It will return false, if the position is invalid.

In app.cpp, the print function is used to print the integers inthe list. The code within app.cpp that will not be modified isbelow:

const int ARRAY_CAP = 100;
int main()
{
        intaList[ARRAY_CAP];
        int size = 0;
        int val;

        print(aList,size);
        insert(0, 10, aList,size);
        insert(1, 20, aList,size);
        insert(0, 4, aList,size);
        insert(1, 40, aList,size);
        insert(2, 25, aList,size);
        print(aList,size);
        if(!remove(5, val,aList, size))
        {
               cout << “remove failed” << endl;
        }
        else
        {
               cout << val << ” is removed!” << endl;
        }
        if(!remove(1, val,aList, size))
        {
               cout << “remove failed” << endl;
        }
        else
        {
               cout << val << ” is removed!” << endl;
        }
        print(aList, size);

        return 0;
}

Expert Answer


Answer to Using C++, implement the two functions specified in list.h. You need to fill in the implementation in list.cpp bool inse… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *