Feb 6, 2022
-
Develop, compile, and run a C++ program that requires C++ repetition control structures including the while loop, do - while loops, and/or for loops that utilize fundamental algorithms studied to perform common tasks, such as finding the max and min of a data set, counting, summing, tracking a previous value, searching and sorting, reading until EOF, etc. in programs to solve problems.
-
Transfer a program to the Unix server, use the G++ compiler to compile a program and execute a c++ program that you have written
-
Use the basic set of Unix commands to manipulate files.
-
Write a C++ program to print all the twin prime numbers below a certain given number. "A twin prime is a prime number (Prime Number Wiki) that is either 2 less or 2 more than another prime number—for example, either member of the twin prime pair (41, 43). In other words, a twin prime is a prime that has a prime gap (Prime Gap Wiki) of two. Sometimes the term twin prime is used for a pair of twin primes; an alternative name for this is prime twin or prime pair." See the Twin Prime Wiki
-
Your program should output the number of twin prime numbers found.
-
This program should be called TwinPrime.cpp
-
Include the basic header in your program (Required Header Template)
-
Accept the upper limit from the user (as an integer)
-
Loop until the upper limit number entered is >=1
-
Loop from 1 to the upper limit and print all twin prime numbers and the number of twin prime numbers found.
-
Add comments wherever necessary
- Follow the course coding standards outlined in Coding Standards_ (COP3363 Introduction to Programming in C++ for Majors).docx Coding Standards .
- Use
g++ TwinPrime.cpp -o TwinPrime.exe
and thenTwinPrime.exe
in a Linux terminal to compile and run.