Question

c++ question i just need answer for this question Dont need to write all program.Thanks

Use the following class declaration when answering this question: class Containers w public: void disconnect( const int conta

0 0
Add a comment Improve this question Transcribed image text
Answer #1
void Containers::disconnect(const int container_id) {
    for (int i = 0; i < count; ++i) {
        if (cargo[i] == container_id) {
            for (int j = i; j < count - 1; ++j) {
                cargo[j] = cargo[j + 1];
            }
            count--;
            break;
        }
    }
}
Add a comment
Know the answer?
Add Answer to:
c++ question i just need answer for this question Dont need to write all program.Thanks Use...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • C++ assignment help! The instructions are below, i included the main driver, i just need help...

    C++ assignment help! The instructions are below, i included the main driver, i just need help with calling the functions in the main function This assignment will access your skills using C++ strings and dynamic arrays. After completing this assignment you will be able to do the following: (1) allocate memory dynamically, (2) implement a default constructor, (3) insert and remove an item from an unsorted dynamic array of strings, (4) use the string class member functions, (5) implement a...

  • Consider the Tollowing class declaration: class student record public: int age; string name; double gpa; }:...

    Consider the Tollowing class declaration: class student record public: int age; string name; double gpa; }: Implement a void function that initiatizes a dynamic array of student records with the data stored in the file "university body.txt". The function has three formal parameters: the dynamic array "S db, the count, and the capacity. Open and close an ifstream inside the function. Remember, you must allocate memory for the initial size of the dynamic array using "new" inside this function. If...

  • Studying for an exam and would like help on the following review question: 17. Consider the...

    Studying for an exam and would like help on the following review question: 17. Consider the following class declaration when answering this question class DB_Arrays { public:        DB_Arrays( );                       //default constructor.        DB_Arrays(const DB_Arrays & Org); //copy constructor.       ~DB_Arrays( );                 //destructor.        void Print_Arrays( );         //prints the contents of both arrays (DB1 followed by DB2)        void Insert(const string &, const int & loc);   //adds a string to the back of DB1 if loc =1; otherwise string is...

  • I need a c++ code please. 32. Program. Write a program that creates an integer constant...

    I need a c++ code please. 32. Program. Write a program that creates an integer constant called SIZE and initialize to the size of the array you will be creating. Use this constant throughout your functions you will implement for the next parts and your main program. Also, in your main program create an integer array called numbers and initialize it with the following values (Please see demo program below): 68, 100, 43, 58, 76, 72, 46, 55, 92, 94,...

  • I need help with a engineering problem solving with programming with C question, it says: Write...

    I need help with a engineering problem solving with programming with C question, it says: Write a function that fills a vector with zeros. Assume that the function prototype statement is: void zeros(int x[], int n); where x is a one-dimensional array with n elements. Give a reference to the function that fills positions 20 to 25 of an array with zeros.

  • I need help solving this question from the practice final exam given to us to prepare...

    I need help solving this question from the practice final exam given to us to prepare for the final in C++ #include <iostream> using namespace std; /* The following is code for an OrderedCollection container and its related iterator. The container has a capacity determined by a constructor parameter. The container does not grow. Code that adds elements to the container ensures that the capacity of the container is never exceeded. An attempt to add an item to a full...

  • Hi!, having trouble with this one, In this class we use visual studio, C++ language --------------------------------------------------------------...

    Hi!, having trouble with this one, In this class we use visual studio, C++ language -------------------------------------------------------------- Exercise #10 Pointers - Complete the missing 5 portions of part1 (2 additions) and part2 (3 additions) Part 1 - Using Pointers int largeArray (const int [], int); int largePointer(const int * , int); void fillArray (int * , int howMany); void printArray (const char *,ostream &, const int *, int howMany); const int low = 50; const int high = 90; void main()...

  • This is C++ Question 1 (12 points) (2 points each) Matching (match each answer only once)...

    This is C++ Question 1 (12 points) (2 points each) Matching (match each answer only once) match function type to function. Function header with a reference parameter 1. myFun(x); Function prototype with an array parameter 2. int myFun(int x) Function header that returns a value 3. void myFun(int &x) Function call 4. void myFun(int, int =0); 5. void myFun(int x) Function prototype with a default value 6. void myFun(int[], int); Function header with no return value

  • C++ problem to use dynamic memory allocation (of arrays) and pointer manipulation in order to implement...

    C++ problem to use dynamic memory allocation (of arrays) and pointer manipulation in order to implement the Inner and Outer classes (Circular Buffer of circular buffers using Queues). No need of any classes from the Standard Template Library (STL), not even vector. Add the member functions of those classes by following the codes of InnerCB.h and CBofCB.h below: // file: InnerCB.h // Header file for Inner Circular Buffer. // See project description for details. // #ifndef _INNERCB_H_ #define _INNERCB_H_ class...

  • Please answer this question clearly and correctly! the code should be handwritten if all possible!! ALSO...

    Please answer this question clearly and correctly! the code should be handwritten if all possible!! ALSO MAKE SURE IT IS WRITTEN IN C++! thank you so much in advance and I will upvote when done right! (8 points) Create a class called resizeableArray. Include an int pointer arrayPtr variable that points to a dynamic array, a capacity variable that holds the dynamic array maximum size and a currentSize variable that has the current number of elements assigned in the dynamic...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT