It is a very good start.
Checking primes is actually a pretty involved subject.
Your prime checker is deterministic, but slow. Things to consider:
- check 2 before the loop
- in the loop, only check odd numbers
- once you find a factor, you can break out of the loop
- your algorithm currently identifies every factor of the number
twice:
12%3 == 0 should also tell you that 12%4 == 0, since 12/3 == 4
- the question is, then, when can you stop?
Also, concerning line 41, you should prefer a loop to recursion for this kind of thing.
Good job!
[edit] Oh, BTW, that
??(
means something. (Do you see
in your prompt?
If you want two exclamation marks next to each other, mark one of them with a backslash:
cout << "Next number \??(y/n)\n>>>";
or
cout << "Next number ?\?(y/n)\n>>>";