Trending News
Help with C++ program?
Your main function should begin by calling a function called “getInput”. getInput should
not take any parameters and prompt the user to enter a positive number. Once the user
has entered a valid number, getInput should return the number entered. I will call this
number N.
After obtaining N, your main program should compute the first N prime numbers. In
order to figure out if a certain number is prime, you will call/write a function called
“isPrime”. isPrime accepts one parameter (call it x) and returns true if x is a prime
number and false if they number is not.
Here is some sample input/output:
How many prime numbers do you want? 10
1: 2
2: 3
3: 5
4: 7
5: 11
6: 13
7: 17
8: 19
9: 23
10: 29
You do not need to ask the user if they want to continue, you can just exit right away
(after computing and printing the first N prime numbers).
Although you are required to write the getInput and isPrime function exactly as specified,
you are free to use/write as many other functions as you wish.
I just need some help with it please