2021年3月24日星期三

Reading Polynomials from Input File (in Java)

I need to read a polynomial from a file. The problem I am facing is if the coefficients were more than one digit or if it had a negative sign, I don't know how to make the program recognize multiple digits are a single integer. That is going to really complicate my code when doing it manually since I need to make the program "aware" of its surrounding like when to start and stop. So, are there any in-built libraries that can be used to parse this? (While I was researching, I found Pattern and Matcher classes but not really sure if it can be used in this context).

For example, I know how to code for this 2x^2 + 4x + 8 but not for something like -22x^2 - 652x + 898.

Any help is appreciated.

https://stackoverflow.com/questions/66791167/reading-polynomials-from-input-file-in-java March 25, 2021 at 08:02AM

没有评论:

发表评论