I'm not sure you understood what I was saying, let me give an example.
You have some input like this:
1 2 3 4 5 6 -1 7 8 9 10
When you reach (-1) you should print out the numbers up untill then, then move on to the next set of numbers.
The problem I'm having is that I can read in and print the first set of number, but when I try to move on the next output includes the (-1) and doesn't move on.
What I'm working on specifically is loading these numbers into a tree. So the first set of numbers goes into tree1, you hit the -1, skip it, and put the next set of numbers in tree2. The specific problem I'm having is that it is not skipping -1, it's loading it into tree2 and then stopping there.
Here is the code I am working on that I am facing this problem with:
As you may see, I tried using the peek and ignore function but the way I had it was not working, I also tried it several different ways, but had no luck.
if(num>=1) //If the number is greater than or equal to one (meaning not -1)
Tree.insert(num); //Insert that number into tree 1
/*if (fin.peek() == '-' && fin.peek() == 1)
for (int i=2; i < 10; i++) //Starting at tree 2
Tree[i].insert(num); //Insert next set of numbers
Any suggestions on how to fix this?