15 Pages

208 Day 09 repititon2

Course: NSSA 4002 208, Spring 2009
School: RIT
Rating:
 
 
 
 
 

Word Count: 416

Document Preview

Intro. 4002-208 to Prog. [in C++] Day 09 More on Repetition Objectives Review while loop for loop Auto increment operator Accumulator Compound operator 4002-208 2 Review of while loop while (loop condition) { loop body } Loop condition is a Boolean condition. Execute loop body if loop condition is true. 4002-208 3 Use a Sentinel Loop //read first input value while (input is invalid) { //execute code...

Register Now

Unformatted Document Excerpt

Coursehero >> New York >> RIT >> NSSA 4002 208

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
Intro. 4002-208 to Prog. [in C++] Day 09 More on Repetition Objectives Review while loop for loop Auto increment operator Accumulator Compound operator 4002-208 2 Review of while loop while (loop condition) { loop body } Loop condition is a Boolean condition. Execute loop body if loop condition is true. 4002-208 3 Use a Sentinel Loop //read first input value while (input is invalid) { //execute code //read another input value } 4002-208 4 Finger work Run the program grades.cpp Add a data validation loop to ensure score is between 0 and 100, inclusively. 4002-208 5 for loop Most common use is to execute the loop body a specific number of times Basics Initialize counter Test counter halt loop when test is false Change counter for(initialize counter; test counter; change counter) 4002-208 6 Perform code a specific number of times for ( int counter = 1 ; counter <= number_of_times ; counter=counter+1 ) { //code to repeat } 4002-208 7 Print 1 to 10 Initialize counter: int k = 1 Test counter: k<=10 Change counter: k=k+1 for (int k=1; k<=10; k=k+1) { cout << k << endl; } 4002-208 8 Counter Numeric variable used for counting. Examples Number of test scores Number of employees Declare as type int as the count is a whole number. If counter declared in for statement, local in variable loop body only. 4002-208 9 Finger work Print 1 up to 25 Print -5 up to 5 Print even numbers from 0 up to 40 Print 10 down to 0 Read in number of times that loop is to be execute, that is, 1 to number of times Run the program for the number of times 5, 10, 1, 0, -5 4002-208 10 Auto increment The update part of for statement is k=k+1 The operator ++ is auto increment, that is, add one to an integer variable. k=k+1 is the same as k++ (generally) Technically, this is post increment as ++ is placed after the variable Pre increment ++k In for statement, both work the same. 4002-208 11 Accumulator A variable that adds up a set of numbers, here scores. Format: sumScores = sumScores + score; Add the current value of sumScores to score and store the sum back into the variable sumScores Acts like the total on a cash register. 4002-208 12 Finger work Back to grades.cpp Read in the number of grades to be entered. Compute and print the average of the scores. 4002-208 13 Compound Operators sumScores = sumScores + score; equivalent to sumScores += score; Does not require the programmer to type the accumulator variable name twice. 4002-208 14 More Compound Operators += -= *= /= %/ x += 5; x -= b; x *= c + 2; x /= 5; x %= 5; x = x + 5; x = x b; x = x * (c + 2); x = x / 5; x = x % 5; 4002-208 15
Find millions of documents on Course Hero - Study Guides, Lecture Notes, Reference Materials, Practice Exams and more. Course Hero has millions of course specific materials providing students with the best way to expand their education.

Below is a small sample set of documents:

RIT - NSSA - 4002 208
4002-208 Intro. to Prog. [in C+] Day 10 Yet more on RepetitionObjectives Basics of the do-while statement Using do-while for a &quot;Yes/No&quot; loop Writing a do-while for data validation Writing a while loop to act as a for loop4002-2082Review o
RIT - NSSA - 4002 208
4002-208 Intro. to Prog. [in C+] Day 11 Introduction to FunctionsObjectives Why use functions? How to write a function Function prototype Random numbers4002-2082Why Functions To avoid writing the same code more than once write once, use
RIT - NSSA - 4002 208
4002-208 Intro. to Prog. [in C+] Day 12 More on FunctionsObjectives Models of function uses Documentation4002-2082Model of a function 0 or more parametersNamed block of code0 or 1 return value4002-2083Output Functions 1 or more
RIT - NSSA - 4002 208
4002-208 Intro. to Prog. [in C+] Day 13 Yet More on FunctionsObjectives Review of Functions Storage classes Scope Rules Separate Compilation using projects4002-2082Writing a function Function headerReturn type or void if no return type
RIT - NSSA - 4002 208
4002-208Practice Exam 1 Sample Problem for Part 2You are to write an entire C+ program to compute the cost of buying a number of movie tickets. The price for a ticket varies depending on the buyers age. If the buyer is 62 or older, the buyer is a
RIT - NSSA - 4002 208
Rochester Institute of Technology Golisano College of Computing and Information Sciences Department of Information TechnologyName: _ 4002-208 Lab 7: More FunctionsExercise 1 Calculating weekly wage (3 points)This exercise must be completed durin
RIT - NSSA - 4002 208
Name: _ 4002-208 Lab 03: Extended Stock Purchase ProgramExercise 1 Data Validation (3 points)The exercise must be completed during the lab period. You are to extend the program from Lab 02. Download the zip file from your lab day module within the
RIT - NSSA - 4002 208
Rochester Institute of Technology Golisano College of Computing and Information Sciences Department of Information TechnologyName: _ 4002-208 Lab 4: switch statement and sentinel loopsExercise 1 switch statement (2 points)This exercise must be c
RIT - NSSA - 4002 208
Rochester Institute of Technology Golisano College of Computing and Information Sciences Department of Information Technology 4002-208 Introduction to Programming in [C+] Updated Project 2 [changes in yellow]Purpose Project 2 extends Project 1 by al
RIT - NSSA - 4002 208
Rochester Institute of Technology Golisano College of Computing and Information Sciences Department of Information Technology 4002-208 Introduction to Programming in [C+] Project 3Purpose I know that youve probably had your fill of transmission time
RIT - NSSA - 4002 208
Rochester Institute of Technology Golisano College of Computing and Information Sciences Department of Information Technology 4002-208 Introduction to Programming [in C+] Project 5 A Taxing AssignmentProblem Statement You are to write a program to p
RIT - 0501 - CrimJust
11 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 VS. DOES 1-4, VS.UNITED STATES DISTRICT COURT FOR THE DISTRICT OF MASSACHUSETTS -CAPITAL RECORDS, INC., ET AL., PLAINTIFFS ) ) ) ) ) ) ) ) ) PLAINTIFFS ) ) ) DEFENDANTS --MOTION H
RIT - 0501 - CrimJust
RIT - 0501 - CrimJust
U.S. Department of Justice Office of the Inspector GeneralA Review of the FBIs Use of National Security Letters: Assessment of Corrective Actions and Examination of NSL Usage in 2006Office of the Inspector General March 2008UNCLASSIFIEDA-1A
RIT - 0501 - CrimJust
UNITED STATES DISTRICT COURT SOUTHERN DISTRICT OF NEW YORK -x THE ASSOCIATED PRESS, Plaintiff, -against08 Civ. 323 (PKC) MEMORANDUM AND ORDERALL HEADLINE NEWS CORP., AHN MEDIA CORP., W. JEFFREY BROWN and DANIELLE GEORGE, Defendants. -x P. KEVIN CAS
RIT - 0501 - CrimJust
Case 1:03-cv-11661-NGDocument 761Filed 02/27/2009Page 1 of 1
RIT - 0501 - CrimJust
RIT - 0501 - CrimJust
Case 7:06-cv-11520-SCR-PEDDocument 89Filed 02/26/2009Page 1 of 1
RIT - 0501 - CrimJust
IntheMatterof ) ) Google,Inc.and ) CloudComputingServices) _) ComplaintandRequestforInjunction,Request forInvestigationandforOtherRelief SUMMARYOFCOMPLAINT 1. Thiscomplaintconcernsprivacyandsecurityrisksassociatedwiththe provisionofCloudCom
RIT - 0501 - CrimJust
soulxtcScoffs at RIAA's demands that he disclose details of the &quot;homemade music CD&quot; collection of Joel Tenenbaum, an accused file-sharer, he's representing in court.
RIT - 0501 - CrimJust
Case 3:09-cv-00540-JMMDocument 16Filed 03/30/2009Page 1 of 29IN THE UNITED STATES DISTRICT COURT FOR THE MIDDLE DISTRICT OF PENNSYLVANIA MARYJO MIILLER, individually and on behalf of her minor daughter, Marissa Miller, JAMI DAY, individually
RIT - 0501 - CrimJust
Case 2:06-cv-02620-ABC-FMODocument 19Filed 02/02/2007Page 1 of 5Case 2:06-cv-02620-ABC-FMODocument 19Filed 02/02/2007Page 2 of 5Case 2:06-cv-02620-ABC-FMODocument 19Filed 02/02/2007Page 3 of 5Case 2:06-cv-02620-ABC-FMODocume
RIT - 0501 - CrimJust
F:\M11\NADLER\NADLER_010.XML[110H3189]. (Original Signature of Member)111TH CONGRESS 1ST SESSIONH. R. llTo establish reasonable procedural protections for the use of national security letters, and for other purposes.IN THE HOUSE OF REPRES
RIT - 0501 - CrimJust
AO 91 Rev. 11/97CRIMINAL COMPLAINT CENTRAL DISTRICT O F CA LIFORNIADOCKET NO.UNITED STATES DISTRICT COURT UNITED STATES OF AMERICA v. PAUL G. ASHLEY, JONATHAN DAVID HALL, JOSHUA JAMES SCHICHTEL, RICHARD ROBY and LEE GRAHAM WALKERMAGISTRATE'S C
RIT - 0501 - CrimJust
RIT - 0501 - CrimJust
U.S. Customs and Border Protection Policy Regarding Border Search of Information July 16,2008This policy provides guidance to U.S Customs and Border Protection (CBP) Officers, Border Patrol Agents, Air and Marine Agents, Internal Affairs Agents, an
RIT - 0501 - CrimJust
IN THE UNITED STATES DISTRICT COURT FOR THE EASTERN DISTRICT OF NORTH CAROLINA Civil Action No. 5:08-CV-00131-D SONY BMG MUSIC ENTERTAINMENT, Inc., UMG RECORDINGS Inc., ELECTRA ENTERTAINMENT GROUP, Inc., BMG MUSIC, and MOTOWN RECORD COMPANY, L.P., Pl
RIT - 0501 - CrimJust
UNITED STATES DISTRICT COURT FOR THE EASTERN DISTRICT OF NORTH CAROLINA WESTERN DIVISION No.: 5:08-cv-00131-D SONY BMG MUSIC ENTERTAINMENT, UMG RECORDINGS INC., ELECTRA ENTERTAINMENT GROUP, INC., BMG MUSIC, AND MOTOWN RECORD COMPANY, L.P., Plaintiffs
RIT - 0501 - CrimJust
United States Court of Appeals for the Federal Circuit2008-1352 TRIANTAFYLLOS TAFAS, Plaintiff-Appellee, and SMITHKLINE BEECHAM CORPORATION (doing business as GlaxoSmithKline), SMITHKLINE BEECHAM PLC, and GLAXO GROUP LIMITED (doing business as Glaxo
RIT - 0501 - CrimJust
Case 1:03-cv-11661-NGDocument 760Filed 02/24/2009Page 1 of 3IN THE UNITED STATES DISTRICT COURT FOR THE DISTRICT OF MASSACHUSETTS ) ) ) Plaintiffs, ) ) v. ) ) NOOR ALAUJUN, ) ) Defendant. ) _) CAPITOL RECORDS, INC., et al.Civil Action No. 0
RIT - 0501 - CrimJust
Case 1:03-cv-11661-NGDocument 763Filed 02/27/2009Page 1 of 3Case 1:03-cv-11661-NGDocument 763Filed 02/27/2009Page 2 of 3Case 1:03-cv-11661-NGDocument 763Filed 02/27/2009Page 3 of 3
RIT - 0501 - CrimJust
Case 1:03-cv-11661-NGDocument 763-2Filed 02/27/2009Page 1 of 5Case 1:03-cv-11661-NGDocument 763-2Filed 02/27/2009Page 2 of 5Case 1:03-cv-11661-NGDocument 763-2Filed 02/27/2009Page 3 of 5Case 1:03-cv-11661-NGDocument 763-2F
RIT - 0501 - CrimJust
Case 1:03-cv-11661-NGDocument 793Filed 03/22/2009Page 1 of 39IN THE UNITED STATES DISTRICT COURT FOR THE DISTRICT OF MASSACHUSETTS ) CAPITOL RECORDS, INC., et al. ) ) Plaintiffs, ) ) v. ) ) NOOR ALAUJUN, ) ) Defendant. ) __)Civil Action No.
RIT - 0501 - CrimJust
circular 92Copyright Law of the United Statesand Related Laws Contained in Ttle 17 of the United States Codeoctober 2007The Constitutional Provision Respecting CopyrightThe Congress shall have Power To promote the Progress of Science and u
RIT - 0501 - CrimJust
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 / WLH:wlh The Grand Jury charges: [18 U.S.C. 1030(a)(5)(A)(i), (B)(i)] Introductory Allegations At all times relevant to this Indictment: 1. Pacific Energy Resources, Ltd. (P
RIT - 0501 - CrimJust
Case 1:07-cv-02103-LLSDocument 117Filed 07/02/2008Page 1 of 25UNITED STATES DISTRICT COURT SOUTHERN DISTRICT OF NEW YORK -x VIACOM INTERNATIONAL INC., et al., Plaintiffs, v. YOUTUBE INC., YOUTUBE LLC, and GOOGLE INC., Defendants. -x THE FOOTB
RIT - 0501 - CrimJust
Capitol v. Thomas Expert witness report by Dr. Yongdae Kim, Ph.D.March 3, 20091OverviewThis report addresses the overall problem of identifying computers remotely through the Internet, the nature and extent of material errors in the expert wit
RIT - 0501 - CrimJust
Eastern District of New York - Live Database Version ESR 3.2.2https:/ecf.nyed.uscourts.gov/cgi-bin/DktRpt.pl?982452137387822-L_80.U.S. District Court Eastern District of New York (Brooklyn) CIVIL DOCKET FOR CASE #: 1:07-cv-00414-DGT-RMLVirgin R
UC Davis - EXB - 101
Study Questions: Lecture 17-19 Exercise Metabolism What hormone is responsible for regulating glucose uptake at rest and following a meal? Insulin What accounts for the increase in glucose uptake with exercise? Glucose needs to be utilized as another
UC Davis - EXB - 101
ReviewQuestions,EXB101,Fall,2008,Lectures3338LECTURE34:PrinciplesofEnvironmentalPhysiologyandTemperatureRegulation FACTS 1. Howmuchofaneffectdoesambienttemperaturehaveonperformance? Itaffectswhetherornotheatisabletobelostduringexercise.Betterperform
UC Davis - EXB - 101
LECTURES22,23,24,and25:CardiovascularStructureandFunction FACTS 1. DescribeVO2usingtheFickprincipleandidentifytheequationsforbothpulmonary(tothelungsandback) &amp;cvsystems. VO2=Qcx(arterial[O2]venous[O2]) Ingeneral:oxygenconsumption=totalbloodflow(cardi
Berkeley - MSE - 104
UNIVERSITY OF CALIFORNIA College of Engineering Department of Materials Science &amp; Engineering Professor R. GronskyMSE 104Solution 2-14Problem 2-14 Pole A, whose coordinates are 20N, 50E, is to be rotated about the axes described below. In each
Academy of Design Chicago - HISTORY - 0009
&quot;The knowledge that we value the most is the knowledge for which we can provide the strongest justifications.&quot; To what extent would you agree with this claim? The defining and pursuit of knowledge have been paramount to human intellectual growth. The
Academy of Design Chicago - HISTORY - 0009
To what extent was the partition of India due to Great Britains Involvement in World War Two? A. Plan of InvestigationTo what extent was the partition of India due to Great Britains Involvement in World War Two? On August 14, 1947, the Dominion of
Academy of Design Chicago - HISTORY - 0009
Hendley 1 Johanna Hendley AP/IB Literature and Composition Mrs. Griffo 6 January 2009 Words: 1,349 The Death of Ivan Ilyich Key Passage The chosen passage is from chapter six of Leo Tolstoys The Death of Ivan Ilyich. In the passage, Tolstoy uses pers
Academy of Design Chicago - HISTORY - 0009
Crows beaks are not strong enough to break some nuts open. In order to open these nuts, they will repeatedly drop the nut on a hard surface until it opens. This investigation will explore the relationship between the height of the drop, and the numbe
Academy of Design Chicago - HISTORY - 0009
Language/Thinking/Intelligence Psychology Terms Thinking Cognition - conscious process of knowing or being aware of thoughts or perceptions,including understanding and reasoning Concept - an abstract or general idea inferred or derived from specific
Academy of Design Chicago - HISTORY - 0009
IntroductionThe aim of this study is to replicate Herman Ebbinghaus initial experiment in order to discover the amount of time required to recall different sets of nonsense syllables. When Ebbinghaus first designed this experiment, he used nonsense
Academy of Design Chicago - HISTORY - 0009
According to Hume, knowledge consists of information that can be gained from the inspection of two or more ideas. Discovering causation is different. This sort of information does not merely depend upon looking at two or more ideas. If we examine a s
Academy of Design Chicago - HISTORY - 0009
&quot;The Second Coming&quot;Summary The speaker describes a nightmarish scene: the falcon, turning in a widening &quot;gyre&quot; (spiral), cannot hear the falconer; &quot;Things fall apart; the center cannot hold&quot;; anarchy is loosed upon the world; &quot;The blood-dimmed tide
Colorado - EMUS - 1832
Time is changed to 8:30100 point exam like midterm, 8 listening identifying era or country, 8-10 more for from listening, roughly 30% of test is listening. Final Review Sheet MUEL 1832-002 Fall 2008 Terms/Concepts (multiple choice/matching/true-fals
Colorado - EMUS - 1832
MUEL 1832 Mid-term Review Sheet (Preliminary-additions may appear) Terms Ballad opera- colonial period in 18th century, comedy, included spoken word, emphasis on plot, short songs, Oratorio- genre of choral music with sacred words, quite long, clear
Colorado - HIST - 2616
Charles Ryan Sundling HIST 2616 Failure without Native American Women La Nouvelle France, Espaa dos, or even United Native American Tribes could have been names for what we now know as the United States of America, if it were not for the help of the
Colorado - HIST - 2616
Final Exam Possible Prompts and Structure HIST 2616 YOU WILL NEED TO BRING A BLANK BLUE BOOK TO THE EXAM. DO NOT WRITE YOUR NAME ON IT BEFOREHAND. You might be kind and bring an extra or two since I will not read any exam that is not written in a blu
Colorado - HIST - 2616
Charles Ryan Sundling HIST 2616 Ball Gender and Sarah Rosetta Wakeman The Civil War has been called the war of brother against brother but what about the sisters? Not all women sat at home and acted lady like; some took their rifles in hand and fough
Pittsburgh - HAA - 0030
What Is Modern Art? Precursors to Modern ArtJanuary 8, 2009Some Basic Art Terms Perspective Composition Chiaroscuro Color palette Complementary colors Diminution (of scale) Foreshortening Highlights Medium (pl. media) Modeling Nat
N.C. State - MA - 242
Tuesday, March 31, 2009 2:59 PM Unfiled Notes Page 1Unfiled Notes Page 2
N.C. State - MA - 242
Tuesday, March 31, 2009 2:59 PM Unfiled Notes Page 1Unfiled Notes Page 2
N.C. State - MA - 242
Tuesday, March 31, 2009 2:59 PM Unfiled Notes Page 1Unfiled Notes Page 2
N.C. State - MA - 242
Tuesday, March 31, 2009 3:00 PM Unfiled Notes Page 1Unfiled Notes Page 2