Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribedimage 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 Processing Fundamentals, Design, and Implementation

Authors: David M. Kroenke, David J. Auer

14th edition

133876705, 9781292107639, 1292107634, 978-0133876703

More Books

Students also viewed these Databases questions

Question

can someone explain this? PV = nyingit a pn +-+ (cpn + par) (1+r)

Answered: 1 week ago

Question

Question What is a Roth 403 (b) plan?

Answered: 1 week ago