fork download
  1. import java.io.*;
  2. import java.util.*;
  3. public class PolynomialAddition
  4. {
  5. static File dataInpt;
  6. static Scanner inFile;
  7.  
  8. public static void main(String[] args) throws IOException
  9. {
  10. dataInpt=new File("C:\\llpoly.txt");
  11. inFile=new Scanner(dataInpt);
  12. StringTokenizer myTokens;
  13. String line,polyTerm;
  14. Node poly=new Node();
  15. while (inFile.hasNextLine())
  16. {
  17. line=inFile.nextLine();
  18. myTokens=new StringTokenizer(line);
  19. while (myTokens.hasMoreTokens())
  20. {
  21. polyTerm=myTokens.nextToken();
  22. String first =polyTerm.substring(0,polyTerm.indexOf("x"));
  23. String second=polyTerm.substring(polyTerm.indexOf("^")+1);
  24. System.out.print(first.value + " " + first.value2);
  25. poly.get_at(Integer.Parse(second)) = Integer.Parse(first); //or something
  26. }
  27. System.out.println();
  28. }
  29.  
  30. }
  31. }
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty