Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Information And Database Systems 12th Asian Conference ACIIDS 2020 Phuket Thailand March 23 26 2020 Proceedings

Authors: Pawel Sitek ,Marcin Pietranik ,Marek Krotkiewicz ,Chutimet Srinilta

1st Edition

9811533792, 978-9811533792

More Books

Students also viewed these Databases questions

Question

Write a java program that displays the following interface

Answered: 1 week ago