https://github.com/sofisar/c--_twinprime_spring-2022
This program prints every pair of prime numbers that are two apart up to the number inputted by the user.
https://github.com/sofisar/c--_twinprime_spring-2022
c-plus-plus loops loops-and-iterations searching value-tracking while-loops
Last synced: 2 months ago
JSON representation
This program prints every pair of prime numbers that are two apart up to the number inputted by the user.
- Host: GitHub
- URL: https://github.com/sofisar/c--_twinprime_spring-2022
- Owner: SofiSaR
- Created: 2024-09-29T23:12:12.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-09-30T00:00:09.000Z (8 months ago)
- Last Synced: 2025-01-19T05:41:25.953Z (4 months ago)
- Topics: c-plus-plus, loops, loops-and-iterations, searching, value-tracking, while-loops
- Language: C++
- Homepage:
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Twin Prime Numbers Program
Feb 6, 2022
## Objectives in Practice:
- 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.
## The Instructions That Were Given for the Project:
- 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](https://en.wikipedia.org/wiki/Prime_number)) 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](https://en.wikipedia.org/wiki/Prime_gap)) 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](https://en.wikipedia.org/wiki/Twin_prime)
- Your program should output the number of twin prime numbers found.
### Make sure your program conforms to the following requirements:
1. This program should be called TwinPrime.cpp
2. Include the basic header in your program ([Required Header Template](https://canvas.fsu.edu/courses/193490/files/15396772/download?wrap=1))
3. Accept the upper limit from the user (as an integer)
4. Loop until the upper limit number entered is >=1
5. Loop from 1 to the upper limit and print all twin prime numbers and the number of twin prime numbers found.
6. Add comments wherever necessary- Follow the course coding standards outlined in Coding Standards_ (COP3363 Introduction to Programming in C++ for Majors).docx [Coding Standards](https://canvas.fsu.edu/courses/193490/files/15396757/download) .
## How to Run the Program:
- Use ```g++ TwinPrime.cpp -o TwinPrime.exe``` and then ```TwinPrime.exe``` in a Linux terminal to compile and run.