3 Pages

Lab02_sample

Course: CMPSC 101, Summer 2006
School: Penn State
Rating:
 
 
 
 
 

Word Count: 244

Document Preview

101 CMPSC Introduction to Algorithmic Processes Summer 2007 LAB 2 Simple C++ Program 1. Write a program that asks the user to enter a number between 0 and 5. The program should then display the number in the following pattern. Enter a number between 0 and 5: 4 4 4 4 4 4 4 4 4 4 [sample code] #include<iostream> using namespace std; int main() { int x; cout << "Enter a number...

Register Now

Unformatted Document Excerpt

Coursehero >> Pennsylvania >> Penn State >> CMPSC 101

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.
101 CMPSC Introduction to Algorithmic Processes Summer 2007 LAB 2 Simple C++ Program 1. Write a program that asks the user to enter a number between 0 and 5. The program should then display the number in the following pattern. Enter a number between 0 and 5: 4 4 4 4 4 4 4 4 4 4 [sample code] #include<iostream> using namespace std; int main() { int x; cout << "Enter a number between 0 and 5: "; cin >> x; cout cout cout cout cout cout } << << << << << << endl << endl; x << " " << x << " " << x << " " << " " << x << endl; " " << x << " " << x << " " << x << endl; x << endl; x << endl; endl; return 0; 2. Modify your program to increase the numbers in each line by 1. Enter a number between 0 and 5: 4 4 4 5 5 6 7 7 8 8 [sample code] #include<iostream> using namespace std; int main() { int x; cout << "Enter a number between 0 and 5: "; cin >> x; cout cout cout cout cout cout } << << << << << << endl << endl; x << " " << x << endl; " " << x + 1 << " " << x + 1 << endl; " " << x + 2 << endl; " " << x + 3 << " " << x + 3 << endl; x + 4 << " " << x + 4 << endl; return 0; 3. [text p.38] Write a program that allows the user to enter a number of quarters, dimes, and nickels and then outputs the monetary value of the coins in cents. For example, if the user enters 2 for the number of quarters, 3 for the number of dimes, and 1 for the number of nickels, then the program should output that the coins are worth 85 cents. [sample code] #include<iostream> using namespace std; int main() { int quaters, dimes, nickels, total; cout << "number of quaters? "; cin >> quaters; cout << "number of dimes? "; cin >> dimes; cout << "number of nickels? "; cin >> nickels; total = 25*quaters + 10*dimes + 5*nickels; cout << "total is " << total << " cents\n"; return 0; }
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:

Penn State - CMPSC - 101
CMPSC 101 Introduction to Algorithmic Processes Summer 2007LAB 3 if-else Statement1. [text p.83] Write an if-else statement that outputs the word Passed provided the value of the variable exam is greater than or equal to 60 and the value of the v
Penn State - CMPSC - 101
CMPSC 101 Introduction to Algorithmic Processes Summer 2007LAB 9 I/O Streams1. Write a program that will count total number of integers in a file. The file contains nothing but numbers of type int separated by blanks or line breaks./ File name:
Penn State - CMPSC - 101
CMPSC 101 Introduction to Algorithmic Processes Summer 2007LAB 4 while Loop1. Write a program that will add up the numbers from 1 to n (n is a user input)./ File name: Lab04_01_for.cpp / Description: add up the numbers from 1 to n / Lab 04-1 /
Penn State - CMPSC - 101
CMPSC 101 Introduction to Algorithmic Processes Summer 2007LAB 4 while Loop1. Write a program that will add up the numbers from 1 to n (n is a user input)./ File name: Lab04_01.cpp / Description: add up the numbers from 1 to n / Lab 04-1 / Auth
Penn State - CMPSC - 101
CMPSC 101 Introduction to Algorithmic Processes Summer 2007LAB 5 Loop ControlList Headed by Size1. Write a program that sums a sequence of integers. Assume that the first integer read with cin specifies the number of values remaining to be enter
Penn State - CMPSC - 101
CMPSC 101 Introduction to Algorithmic Processes Summer 2007LAB 8 Programming With Arrays1. Write a program that reads in 10 integer numbers and store them in an array. The program should then sort the array using bubble sort algorithm and display
Penn State - CMPSC - 101
CMPSC 101 Introduction to Algorithmic Processes Summer 2007LAB 6 Nested Loop1. Write a program that uses a nested loop to generate the following layout of numbers. 1 2 3 4 5 6 7 8 9 2 3 4 5 6 7 8 93 4 5 6 7 8 94 5 6 7 8 95 6 7 8 96 7 7 8
Penn State - CMPSC - 101
CMPSC 101 Introduction to Algorithmic Processes Summer 2007LAB 7 Function Calls1. Write a program that computes the following mathematical expressions using C+ predefined functions. A.3.7 18.2B. 5 21.7 * 2 11.4 3 7 .3 4 C./ File name: Lab07_
Texas A&M - CHEM - 222
Chapter 2: 13, 14, 19, 23, 24, 40, 43, 55 13. For each condensed structural formula, write a line angle formula.a.CH2CH3 CH3 CH3CH2CHCHCH2CHCH3 CH(CH3)2 CH3b.CH3CCH3 CH3 (CH3)2CHCH(CH3)2 CH2CH3 CH3CH2CCH2CH3 CH2CH3 (CH3)3C CH3(CH2)3CH(CH3)2
Texas A&M - CHEM - 222
Chemistry 222 Chapter 3: 13, 14, 15, 17, 19, 23, 33, 34, 37, 38, 45, and 65 13. Predict all bond angles about each highlighted carbon atom.Ca.b.C C CH2 OHc. HCCCHCH2d.C14.Predict all bond angles about each highlighted carbon atom
Texas A&M - CHEM - 222
Name. Seat #.. .Chemistry 222 Exam 1 F Form ABefore you begin: -Bubble in your name, University ID number, and test form on your scantron.1.Multiple-Choice: -Select the letter of the response that best completes the statement or answers the
Texas A&M - CHEM - 222
Chemistry 222-500 Spring 2007 Hybrid Orbitals and Multiple Bonds 1. Consider the acetonitrile molecule:Ha. Predict the bond angles around each carbon atom b. Give the hybridization at each of the carbon atoms H C c. Determine the total number of
Texas A&M - CHEM - 222
Chemistry 222-500 Spring 2007 Hybrid Orbitals and Multiple Bonds 1. Consider the acetonitrile molecule:a. Predict the bond angles around each carbon atom. Approximately 109.5o around the left C, and 180o on the right C H C C N b. Give the hybridiza
Texas A&M - CHEM - 222
Chemistry 222, section 500 Spring 2007 Polar Bonds and Molecules 1. Classify each of the following compounds as nonpolar covalent, polar covalent, or ionic: a. Br2 b. Mg3N2 c. N2O d. SF6 e. LiF 2. Select the more polar bond in each of the following p
Texas A&M - CHEM - 222
Chemistry 222, section 500 Spring 2007 Polar Bonds and Molecules 1. Classify each of the following compounds as covalent or ionic: a. Br2 covalent b. Mg3N2 ionic c. N2O covalent d. SF6 covalent e. LiF ionic Note: These answers can be determined simpl
St. Mary MN - ENG - 103
JM Teen Driver Dead, this is a headline that we see all too much in newspapers today. So, why do we continue to let these situations happen? I didn't receive my license when I was 16, my parents made me wait until I turned seventeen. My parents made
St. Mary MN - BUS - 100
Jim McErlean Project 1 Overview of Business &amp; Ethics Bus 100 section-300 Submitted to Professor Larry Odelson Moraine Valley CC Submitted by: Jim McErlean Date: 6/22/081) The first article, by Curtis Verschoor, is about the recent ethical issues ins
Lake Land - ART - 152
Jim McErlean Officer Bud White, portrayed by Russell Crowe, is a hardnosed detective for the L.A. police department who wears his emotions on his sleeve. He is looked at by his peers as the bruiser and enforcer of the force. Buds tactics are rarely,
St. Mary MN - ART - 152
Jim McErlean The scene I have chosen is when Curtin first realizes Dobbs is talking to himself. Dobbs, starting to show his greed, is talking to himself, and the animals, about the other two's &quot;plot&quot; to get him. This scene shows that Dobbs is startin
St. Mary MN - ART - 152
Jim McErleanThe first scene is when Joel and Clementine run through the train station into a party Clementine is at, then into the doctor's office. This scene combines the &quot;oddness&quot;, or possibly confusing points of the movie into a clearer picture.
Colorado - FNCE - 3010
Finance: Book Reading Chapter 1 Finance a Quick Look 4 Basic Areas o Corporate Finance o Investments (stocks and bonds) What determines the price of a financial asset such as a share of stock? What are the potential risks and rewards associated wit
Colorado - BCOR - 22
Finance-Final Study Guide Chapter 10-Dollar Returns: if you buy any asset, your gain or loss from that investment is called your return on investment and usually has 2 components-1) you may receive cash directly while you own investment (income comp
UCLA - MGMT - 122
Chapter 4 NotesPage 1IV. Activity-Based CostingIn this chapter we will focus on the application of Manufacturing Overhead to a firm's products and services. In particular, we will see that dividing your Manufacturing Overhead into separate cost
Colorado - BCOR - 3000
DO NOT BE LATE FOR EXAM. 10:30am, HUMN 1B50 (Same Room as Class) Chapter 5 o PAGE 136 CHART.quiz yourself on all the CHARTS o TRADE DRESS Protected similarly as trademarks Involves an appearance Ex: TGI Fridays.all have red and white striped tables
Colorado - BCOR - 3000
CHAPTER 33: LABOR AND EMPLOYMENT LAW Employment at Will o Either party can terminate employment at any time and for any reason Exceptions to Employment at Will o Employment contract o Implied employment contract o Wrongful discharge based on tort o P
Colorado - FNCE - 4030
Chapter 2: Overview of the Financial System Function of the Financial Markets o Perform the essential economic function of channeling funds through households, firms, and gov'ts that have saved surpless by spending less thant their income to those wh
Colorado - BCOR - 22
1. 2. 3. 4.the valuation of a financial asset is based on the present value of future cash flows the required rate of return in valuing an asset is based on the risk involved bond valuation is based on the process of determining the present value o
Yale - ECON - 324
ChinaPart II Recall: China seized Japanese assets after War, industries nationalized by default After 1949, adopted central planning under Soviet tutelage Central planning: government controls economy, not market Government controls production and d
Yale - ECON - 324
China, Continued SEZs External Relations Openness to trade: Now: (X+M)/Y &gt; 50% Pre 1979: (X+M)/Y &lt; 10% ? SEZs at the beginning were not developed at all 1986, SEZs expanded to all provinces along the coast This was when cross trade with Taiwan actua
Yale - ECON - 324
The Asian Financial Crisis Two theories: fundamentals vs. panic Did not go to other places in the world Real-side vs. financial linkages In crisis, financial linkages much more important Direct vs. indirect linkages Contagion July 4, 1997 Thailand
Cornell - ENGRD - 2020
Jeffrey Katz Lab Section 13 Pre-lab #2 Questions1. The first sample is a popsicle stick/tongue depressor. This is used to measure crosshead displacement. 2. Stress = Load/Area of the middle area Strain = (final displacement initial displacement) /
Cornell - ENGRD - 2020
3. Area of Steel = .05842 in2 a. Ours:Area of Aluminum = .0632 in2Steel: Slope = 1.429*106 lb/in At 1000 lb: displacement = 1000 lb / 1.429*106 lb/in = 6.998*10-4 in Stress at 1000 lb: 1000lb /.05842 in2 = 17.12 ksi Strain at 1000 lb: displacemen
Cornell - ENGRD - 2020
Jeffrey Katz Laboratory 13 Pre-lab Questions1. The maximum load placed on the I-beam will be 1000 pounds. 2. Strain and Stress will be determined by the data (recorded load and deflection) 3.4. 0.25 in by 0.125 in by 4 inches. 5. The purpose is t
Cornell - ENGRD - 2020
Jeffrey Katz Shaina Khan Lab Report #3: Deformation and Failure of BeamsENGRD 2021. The calculations for the ratios are given on the table. To calculate stiffness, one must divide the load that a beam is subjected to by its corresponding deflecti
Cornell - ENGRD - 2020
Cornell - ENGRD - 2020
Cornell - ENGRD - 2020
Cornell - ENGRD - 2020
Cornell - ENGRD - 2020
Carnegie Mellon - ECE - 18100
Carnegie Mellon - ECE - 18100
Carnegie Mellon - ECE - 18100
Carnegie Mellon - ECE - 18100
Carnegie Mellon - ECE - 18100
Carnegie Mellon - ECE - 18100
Carnegie Mellon - ECE - 18100
Carnegie Mellon - ECE - 18100
Carnegie Mellon - ECE - 18100
Carnegie Mellon - ECE - 18100
Carnegie Mellon - ECE - 18100
Carnegie Mellon - ECE - 18100
Carnegie Mellon - ECE - 18100
Carnegie Mellon - ECE - 18100
Carnegie Mellon - ECE - 18100
Carnegie Mellon - ECE - 18100
Carnegie Mellon - ECE - 18100
Carnegie Mellon - ECE - 18100
Carnegie Mellon - ECE - 18100
Carnegie Mellon - ECE - 18100
Carnegie Mellon - ECE - 18100
Carnegie Mellon - ECE - 18100