Wednesday, September 11, 2019

Class Discussion cis 242 Essay Example | Topics and Well Written Essays - 500 words

Class Discussion cis 242 - Essay Example 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: /* â€Å"&&† a logical operator used to compare two conditions, the first condition is either â€Å"a† is greater than â€Å"10† and the second condition is either â€Å"a† is less than 20. If both the conditions get true, the â€Å"statements (A)† will be executed and if anyone of the conditions gets false, the â€Å"statements (B)† will be executed. As â€Å"&&† (and) logical operator has been used, therefore, both the conditions need to be true to execute â€Å"statements (A)†. Boolean operators have significance importance in C++, as these can be used in the conditions to determine either the condition is true or false. In programming, you need decision making structures that are based on conditions, whereas in the conditions we use Boolean operators. The above example explains the conditions along with Boolean Operators in detail. Loops are used to add excitement to roller coaster in amusements parks such as Six Flags. :D Just kidding of course, but in C++, they do the same kind of thing: Start at one point, execute some code, then end up back at where you started. They are useful for when you need to execute a piece of code multiple times. The different loop commands have the same basic function, but execute slightly differently. The while command is the simplest of the loops.Just like we say when we talk while (this) is true, do (this). For example: While the TV is on, I will watch it. Once the TV goes off, I will stop watching it. A good use of while is when asking for an entry, check to see that one of the expected entries is the one that the user used. The while loop checks to see if the condition is true before it

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.