Hey all! I have polynomial programming project that I'm doing where I need to read a set of numbers from a file where each set of numbers are written in the format

<coefficient> <exponent>

on each line in the file. First and foremost I've set up a structure called Term which consists of a float Coeff, and a int Expn and have made an array called Terms[10] to store each polynomial term. I'm pretty bad when it comes to developing a loop to read from a file and I haven't had any experience with structures yet so I'd like some help for reading each set of numbers into the array if you can provide! The file is called 'poly.txt' and the ifstream is called 'fp'. Thanks in advance!

Jess

It's important for us to see what you've tried before offering you our assistance.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.