Polynomial Class and Fstream

For example I have a polynomial class, can I use fstream in main as input for the coefficients? Instead of changing my polynomial class?
Can you explain what you exactly trying to accomplish?
I already have a polynomial class. That doesn't use the fstream. I was thinking that I'll just add the fstream in the main
1. Write a polynomial calculator program that performs the following
- Addition and subtraction
- Multiplication, Division, and Modulo
- Find roots
- Read inputs from a file
- Write outputs to a file
2. Operations can span multiple lines
e.g.:
y1 = x^2 + 3x+ 2
y2 = x^3 – 4
y3 = y1 * y2
y4 = y3 + y2
root(y4)
3. Use Object Oriented Programming to implement the program
Yes, I would take the input from the user in main and then pass it into your class and then your class can return it back to main. You need methods in your class to support that though.
Last edited on
What do you mean by methods? I'm sorry. I'm a beginner in programming. I'm not really sure of what to do.
Method is the same as a function in your class. like:

1
2
3
4
5
6
7
8
class polynomial{

public:

void get_coefficients(int coefficient, int coefficient2)
//something along those lines.
}; 
Great, thanks! I'll see what I can do. :)
Topic archived. No new replies allowed.