Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Objectives: Become familiar with C++ syntax. Become familiar with calculations using C++ programming language. Become familiar with writing functions. Instructions Please add comments to

C++

Objectives:

Become familiar with C++ syntax.

Become familiar with calculations using C++ programming language.

Become familiar with writing functions.

Instructions

Please add comments to your program where appropriate.

Cleary identify all output

NOTE: any steps that are repeated should generally be constructed as functions and called from the mainremember in general the main function (method) is the traffic controller

it should be used to construct a framework and then

it should call other functions using arguments

minimize the use of global variables

it should have limited data logic and/or interaction with the user

And now on with the show

Code your program using the outline starting with step 1.

Create a global struct called FactorStatus that will contain

A first integer

A second integer

A Boolean

that is true if the integers are factors

that is false if the integers are not factors

Create a global vector that will initially hold 4 FactorStatus

Set the size explicitly

Now display info to the user using coutdisplay:

the size of your vector

the capacity of your vector

the contents of all items in your vector

first number

second number

factor status

convert the 0/1 to false/true

pause until user hits enter

Create a loop to loop a number of times that is equal to the size of the vector

Create 2 random numbers between 2 and 24

Send your numbers to a function called: areWeFactors

areWeFactors determines whether the integers are factors of each other.

If they are factors (no remainders after modulus operator then return true

If they are not factors return false

Check both ways first into second and second into first

After the function returns the result, then put your numbers and result in your struct identified by the current index of your loop

Repeat step 3

After the loop is complete then interact with the user

ask the user to enter 2 numbers

Repeat steps 4b thru 4d

When adding to the vector allow C++ to auto increment the size of the arraydo not resize manually.

ask the user to enter 2 numbers

Repeat steps 4b thru 4d again

Repeat step 3

Clear your vector

Repeat step 3

Set the size of the array to 9

Repeat step 4

Repeat step 3

End the program

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_2

Step: 3

blur-text-image_3

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

Database Design Application Development And Administration

Authors: Mannino Michael

5th Edition

0983332401, 978-0983332404

More Books

Students also viewed these Databases questions

Question

Find the derivative of y= cos cos (x + 2x)

Answered: 1 week ago