complex program...challenging

hi, I am having a problem with my program. it is a little comlicated so I will try and explain the best I can.
the program is supposed to get numbers and enter them into a chain of structs.
the struct of type Node2 is supposed to hold only prime numbers and the nodes are the other numbers.
for example if I enter 4,5,6
then the program does as follows
it first check if 4 is prime, because its not It finds the smallest prime number that is a divisor of 4 (which is 2) so the program creates a new node2 and enters the vale 2 as its data, now the box to its 'left' will get the value 4.
next it will get the number 5, because 5 is prime it will create a new box of node2 and enter 5 and then create a box to its left and enter 5.
next it will check 6, 6 is not prime so it will check the smallest prime divisor which is 2, because 2 already is a value for one of the node2 boxes then it will not create a new box, but it will go to the line of node2 and create a new box of type node and enter the value 6.
the problem with my program is that when I enter a prime number in the beginning it causes issues.


http://cpp.sh/9jt2b
Topic archived. No new replies allowed.