Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Tasks Compile and run the provided source code. Familiarize yourself with the flow of the provided code by entering valid and invalid inputs. What

C++

Tasks

Compile and run the provided source code. Familiarize yourself with the flow of the provided code by

entering valid and invalid inputs. What input values cause the code to return?

A prime number is a positive integer greater than or equal to 2 that is evenly divisible, that is no

remainder after division, by itself and 1 only. Write the prime number test algorithm using a For loop.

Make sure your For loop Breaks internally when a number is not prime.

Make sure your For loop runs fully when a number is prime.

Make sure your algorithm tracks primeness.

Make sure your algorithm has been fully tested.

Report the result of your primeness computation to the user.

Make sure your reported result is correct.

Make sure your menu still works.

Ensure your code complies with the following variable naming requirements:

Your Cin user input integer variable is named black.

Your For loop integer variable is named red.

Your primality tracking boolean variable is named blue.

Expected Output

=====PRIME TESTER===== input integer for testing: 2 2 is prime

input integer for testing: 4 4 is not prime

input integer for testing: 1 ====TRY AGAIN====

input integer for testing: 0 ====ALL DONE===== image text in transcribed

#include using namespace std; int main() int uNum; bool 1sPrime = true ; while (true) cout > uNum; if (1

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Visual Basic 4 Ole Database And Controls Superbible

Authors: Michael Hatmaker, C. Woody Butler, Ibrahim Malluf, Bill Potter

1st Edition

1571690077, 978-1571690074

More Books

Students also viewed these Databases questions