In C++ language:
Code that finds and outputs the first x number of prime numbers, beginning with 2, where x is chosen by the user. Remember that a prime number is a number that is only divisible by itself and 1 -- it has no other factors. Note that if the user enters an invalid amount, you must tell them the amount entered is invalid. After a successful or unsuccessful search for prime numbers, prompt the user if they would like to try again.
ex:
Computer: How many prime numbers do you want to see?
User: 0
Computer: I can't search for 0 prime numbers.
Computer: Would you like to try again?
User: Yes
How many prime numbers do you want to see?
User: 5
Computer: The first 5 prime numbers are: 2 3 5 7 11