### Polynomial Program Help

Hi, i'm a beginner in dev c++ and i need to write a program that can add and subtract polynomials.

So far my program asks for the highest power of x, then asks the user to input coefficients based on the power. (for example the user inputs 2 as highest power, the program will ask for coefficients for degree 2, 1, and 0.)

But i put it in a loop so i don't know how it will store the numbers the user inputted and add or subtract them. I'm lost. Help me?

 ``1234567891011121314151617181920212223`` ``````#include #include using namespace std; int main(){ int pow, deg, deg2; cout<<"\n\tEnter highest power of x: "; cin>>pow; int x=pow; cout<<"\n\tFirst Polynomial\n"; do{ cout<<"\tEnter co-efficient for degree "<>deg; }while(x>=0); cout<<"\n\tSecond Polynomial\n"; int x2=pow; do{ cout<<"\tEnter co-efficient for degree "<>deg2; }while(x2>=0); cout<<"\n\n\t"<
You need a runtime-sized array to store a variable amount of input data.
You can allocate it manually or use something like std::vector.
Topic archived. No new replies allowed.