Question: C++ help using a vector not a map or array use both .cpp and .h files Lab 2: Vectors and Classes Create a class PosPoly

C++ help using a vector not a map or array

use both .cpp and .h files

C++ help using a vector not a map or array use both.cpp and .h files Lab 2: Vectors and Classes Create a class

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

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!