Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ help i need to use a vector to complete, not a map also need to have the implementation in .cpp file and declaration of

C++ help i need to use a vector to complete, not a map

also need to have the implementation in .cpp file and declaration of class in .h file

image text in transcribed

Lab 2: Vectors and Classes Create a class PosPoly that stores polynomials in x with positive integer coefficients. For example, 4x + 2x6 + 3x2 + x. The instance variables of your class should be (a) a counter for the number of powers; and (b) a vector of Pair's, where a Pair is a struct (or a class) that stores two ints: the power and the coefficient. The powers should be in the order they were first added. For example, the above polynomial could be stored as: entry Count = 4 power 5 6 2 1 ... coeff 4 2 3 1 ... The class should be stored in files PosPoly.cpp and PosPoly.h. (The code for Pair can be in its own files, but it is also okay to include it in PosPoly.h. It is also okay to adapt/use the Pair class given on the class website as solution to Practice 2.) Your PosPoly class should have the following methods: A default constructor that initializes the polynomial to zero An overloaded

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

Database In Depth Relational Theory For Practitioners

Authors: C.J. Date

1st Edition

0596100124, 978-0596100124

More Books

Students also viewed these Databases questions

Question

Distinguish between intrinsic and extrinsic rewards.

Answered: 1 week ago

Question

Analyze the impact of labor unions on health care.

Answered: 1 week ago

Question

Assess three motivational theories as they apply to health care.

Answered: 1 week ago