Question: C++ Question. Please help. Program #1-Finding Prime Numbers This program asks you to determine a set of prime numbers, given some input from the user.

C++ Question. Please help.

C++ Question. Please help. Program #1-Finding Prime Numbers This program asks youto determine a set of prime numbers, given some input from theuser. Your program should ask the user to enter an integer between

Program #1-Finding Prime Numbers This program asks you to determine a set of prime numbers, given some input from the user. Your program should ask the user to enter an integer between 1 and 100. For purposes of discussion, let's call that number num. If num is outside that range, your program should print out an error message and re-prompt for another number (i.e., have an input validation loop) Your program should then calculate the first num prime numbers and print them both to the screen and to an output file, PrimeOut.txt. Your output should be neatly formatted, 10 numbers per line, and should look like the following examples. For the first example, let's assume num == 20. The first 20 primes: 2 3 7 11 13 1719 23 29 31 37 41 43 47 53 59 61 6771 Or if num- 25; The first 25 primes: 2 3 7 11 13 1719 23 29 31 37 4143 4753 59 61 6771 73 79 83 89 97 Here we are using a 5 byte field just as we did in a previous assignment. Since the 100th prime is a three digit number, that should work well. (Other spacing's are obviously possible; just make sure there are 10 numbers per line.)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!