StudentShare
Contact Us
Sign In / Sign Up for FREE
Search
Go to advanced search...
Free

Class Discussion cis 242 - Essay Example

Cite this document
Summary
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…
Download full paper File format: .doc, available for editing
GRAB THE BEST PAPER95% of users find it useful
Class Discussion cis 242
Read Text Preview

Extract of sample "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 < 10) {statement(s) …….}else{statement(s) …….}/* “ 10 && a < 20) // it asks either the value “a” is between 10 and 20.

statements (A)elsestatements (B)/* “&&” 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.Discussion 2Loops 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 executes its code. Kind of like this:char answer;coutanswer;while (answer != "Y" && answer !="N"){ coutchar;}The while loop will continue to prompt for either a Y or a N until the user gets it right. The do-while is similar to the while loop, but it will execute the code one time before checking to see if the condition is true. Use of this is good for something like an ATM machine. When you put your card in, the program executes, then at the end it asks "Another transaction?". Example:do{/*Writing this not in code to shorten it.

 Welcome to ATM, what do you want to do?Execute the users request.*/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;     //the variable i can be anything, but most programmers use it for "index" indicating that its used to count.for (i = 0; i< 10; i++) cout

Read More
Cite this document
  • APA
  • MLA
  • CHICAGO
(“Class Discussion cis 242 Essay Example | Topics and Well Written Essays - 500 words”, n.d.)
Class Discussion cis 242 Essay Example | Topics and Well Written Essays - 500 words. Retrieved from https://studentshare.org/information-technology/1600334-class-discussion-cis-242
(Class Discussion Cis 242 Essay Example | Topics and Well Written Essays - 500 Words)
Class Discussion Cis 242 Essay Example | Topics and Well Written Essays - 500 Words. https://studentshare.org/information-technology/1600334-class-discussion-cis-242.
“Class Discussion Cis 242 Essay Example | Topics and Well Written Essays - 500 Words”, n.d. https://studentshare.org/information-technology/1600334-class-discussion-cis-242.
  • Cited: 0 times

CHECK THESE SAMPLES OF Class Discussion cis 242

Contribution of High Performance Working towards Greater Skills Utilisation in the UK Organisations

The topic under discussion requires an organization to develop a stimulating environment.... In this paper, an attempt has been made to analyze the extent to which high performance working in organizations can contribute towards greater skills utilisations with reference to the organizations in the UK....
8 Pages (2000 words) Term Paper

Accounting Concepts of British Petroleum

Ampm is the convenience shop brand in Western USA and Wild Bean Cafe provides world class coffee and affordable food.... British Petroleum (BP) was established in the year 1909 by William Knox D'Arcy.... The organisation has its operations in 100 countries around the world.... BP has a production of 3....
8 Pages (2000 words) Case Study

Problem Solution Development Life Cycle

The paper "Problem Solution Development Life Cycle" tells us about the standard technique used mostly by software engineers to create the basic outline and the blueprint of the concluding software.... The process to do so is made simple through the notion of PSDLC.... hellip; At the outset, a radio station encompasses a lot of CDs irrespective of the station's size....
5 Pages (1250 words) Research Proposal

Bioinformatics research

There is ocean of data available in various database generated from genome projects worldwide.... In almost all organism most of the genome contains valuable information pertaining to a specific function or mere data that has not been deciphered.... In the recent decades, advancements in the field of molecular biology coupled with Information technology enabled rapid sequencing of large genome data sets....
21 Pages (5250 words) Dissertation

Marketing of American Online and Amazon

This paper talks that Amazon.... om began as an online bookstore and with its founder Bezos having seen the potential of World Wide Web in making the company big, it did prove right in its expansion and diversification.... Amazon.... om quickly began expanding, branching off into retail sales of music CDs, videotapes and DVDs, software, consumer electronics, kitchen items, tools, and lawn and garden items....
6 Pages (1500 words) Essay

Discussion 1,2 and 3 for cis classes

escribe how you felt about the UNIX operating system at the beginning of the class versus now.... Discuss the availability of DSL, broadband, and fiber-optic access in your area and the pros and cons of each type of Internet access Modern times are driven by digital… and ....
1 Pages (250 words) Essay

Discussion 1,2 and 3 for cis classes

This is through the World Wide Web, mobile messages and e-mails (Parameswaran, Xia, Andrew and Fang 2007). In order to prevent business and… Such programs have a specialty of checking for malware as a part of their internet protection suite (Parameswaran, Xia, Andrew and Fang 2007). RAID technologies increase reliability and performance of systems through Discussion 2 and 3 for cis es Question A malware is software that is malicious in its actions.... This week's discussion was very informative on many different issues....
1 Pages (250 words) Essay

Phenyl Thiocarbanate and Polymerase Chain Reaction

Phenylthiocarbamide (PTC) also known as phenylthiorea (PTU) is an organosulfur thiorea that has phenyl ring (Karlsson, Et al.... 2001).... This chemical has a unique characteristic in that it tastes very bitter to some people or has no taste to other people … PTC tasting is a genetically controlled ability to taste PTC and related substances, these have antithyroid activity (F....
15 Pages (3750 words) Research Paper
sponsored ads
We use cookies to create the best experience for you. Keep on browsing if you are OK with that, or find out how to manage cookies.
Contact Us