Question: I have to write a program specific to the tasks stated in the code and then debug any issues. I've been having some difficulty with

I have to write a program specific to the tasks stated in the code and then debug any issues. I've been having some difficulty with this and any assistance would be greatly appreicated.

Question 1.

#ifndef VECTOR_HPP

#define VECTOR_HPP

class Vector { public: Vector() // default constructor sets size to 0 { }

Vector(int s) // makes size = s, //allocates s space, // makes all entries 0 { }

Vector(const Vector & rhs) // copy constructor // makes self a deep copy of rhs { } Vector operator = (const Vector & rhs) // makes self a deep copy of rhs { return *this; } ~Vector() // default destructor { } v

oid print() // Prints out the vector { }

void set(int val, int pos) // if 0

int main() { Vector a, b(3), c(3) ; int value; a.print(); // outputs [] b.print(); // outputs [ 0 0 0 ] c.set(1,0); c.set(2,1); c.set(3,2); c.print(); // outputs [ 1 2 3 ] Vector d(c); d.print(); // outputs [ 1 2 3 ] a = c; a.print(); return 0; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!