C++ Objectives: Become familiar with C++ syntax. Become familiar with calculatio
ID: 3719713 • Letter: C
Question
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 main…remember 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 cout…display:
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 array…do 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
Explanation / Answer
#include #include #include #include using namespace std; int multiple(int number1, int number2); int main(){ string choice; int number1; int number2; coutRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.