Answered You can hire a professional tutor to get the answer.

QUESTION

Hi, need to submit a 500 words paper on the topic Class Discussion cis 242. Discussion Making Decisions in C++ using Conditions, Operators and Values" Please respond to the following: Explain how deci

Hi, need to submit a 500 words paper on the topic Class Discussion cis 242. Discussion Making Decisions in C++ using Conditions, Operators and Values" Please respond to the following: Explain how decisions are made in C++ programming using conditions, operators, and values. Give a coded example to support your response.

Define the significance of Boolean operators and explain how they relate to the conditions in your discussion. Give an example using C++ syntax to support your response. Note: values can be either variables or constants.

The structure of Decision Making in C++ requires (at-least) one or more conditions for evaluation, if the condition is determined to be true the statement(s) needs to be executed, however, the if the condition is becomes false, there is an option for other statement(s) to be executed. The conditions are composed of operators and values that are used. Operators and values are used to define a condition. The operators can be Relational and Logical operators that are used to compare two values. however, Logical operators are also used to combine two or more conditions. An example is given below for illustration of decision making structure using conditions, operators and values:

If (a &lt. 10)

{

statement(s) …….

}

else

{

statement(s) …….

}

char answer.

coutanswer.

//while loop here to make sure you get a Y or N.

} while (answer == "Y").

The program will go through execution one time, then ask if another transaction is desired. If the answer is yes, it will start all over again, otherwise the loop will exit. The last command is the for loop. Its a little more complex then the previous two, but its very powerful because you can initialize variables within it, check for condition, and then modify variables as well. For loops are great for when you want to repeat something a set number of times. A simple and silly example is if you want to say Hello to the user 10 times when he first logs in. The code would look like this:

inti. &nbsp. &nbsp. //the variable i can be anything, but most programmers use it for "index" indicating that its used to count.

for (i = 0. i&lt. 10. i++)

&nbsp.

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question