Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started