Question: C++ Concepts tested by this program: 1.Learn to organize code within a function 2.Learn to pass data to and return Boolean data from function 3.Use

C++

Concepts tested by this program:

1.Learn to organize code within a function

2.Learn to pass data to and return Boolean data from function

3.Use of loop

4.Use file processing Program Prime Numbers

A prime number is an integer that is greater than 1 and that is only evenly divisible by itself and 1. For example, the number 5 is prime because it can only be evenly divided by 1 and 5. The number 6, however, is not prime because it can be divided evenly by 1, 2, 3, and 6.

Write a function name isPrime, which takes an integer as an argument and returns true if the argument is a prime number, or false otherwise. Demonstrate the function in a complete program that reads in an integer that is less than 3001 stores a list of all the prime numbers from 2 through that number in a file named "PrimeList.txt" and to the standard output.

-Primelist.txt file contents bellow:

2

3

5

7

11

13

17

19

23

Prime numbers written to Primelist.txt.

-Summary of what program has to do:

1. Ask the user "Insert integer number less than 3001."

2. If number is more than 3001 then a error should appear, if it is less, the number insterted will be there and also it will read the "PrimeList.txt" file which contains a list of numbers.

Screenshot: basically number 23 was inserted and the rest came from.txt

C++ Concepts tested by this program: 1.Learn to organize code within a

X CAUserslOwner Documents Visual Studio 20131Projects ConsoleApplication21\DebuglConsoleAp... CMSC 140 CRN xxxx Project 5: Prime Numbers *Written by a student Bill Morgan 04/03/2016 lould you please enter an integer number that should be less than 3001 23 2 19 23 Prime numbers written to PrimeList.txt Press any key to continue

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!