New User Special Price Expires in

Let's log you in.

Sign in with Facebook


Don't have a StudySoup account? Create one here!


Create a StudySoup account

Be part of our community, it's free to join!

Sign up with Facebook


Create your account
By creating an account you agree to StudySoup's terms and conditions and privacy policy

Already have a StudySoup account? Login here

Computer Science I

by: Alessia Farrell

Computer Science I CPSC 220

Alessia Farrell
GPA 3.79


Almost Ready


These notes were just uploaded, and will be ready to view shortly.

Purchase these notes here, or revisit this page.

Either way, we'll remind you when they're ready :)

Preview These Notes for FREE

Get a free preview of these Notes, just enter your email below.

Unlock Preview
Unlock Preview

Preview these materials now for free

Why put in your email? Get access to more of this material and other relevant free materials for your school

View Preview

About this Document

Class Notes
25 ?




Popular in Course

Popular in ComputerScienence

This 4 page Class Notes was uploaded by Alessia Farrell on Friday October 23, 2015. The Class Notes belongs to CPSC 220 at University of Mary Washington taught by Staff in Fall. Since its upload, it has received 23 views. For similar materials see /class/228391/cpsc-220-university-of-mary-washington in ComputerScienence at University of Mary Washington.


Reviews for Computer Science I


Report this Material


What is Karma?


Karma is the currency of StudySoup.

You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!

Date Created: 10/23/15
Multi dimensional Arrays 2 D arrays Allow you to store a table of data Example oat examGrades3 1 dimensional array lets you store 3 grades for one student To store several grades for many students using one identi er 7 use a 2D array const int MAXPEOPLE 10 const int NUMGRADES 3 oat examGradesMAXPEOPLENUMGRADES Iist row rst col second How to use it 7 requires 2 loops to read data into indiVidual array cells for i 0 ilt MAXPEOPLE i for j 0 j lt NUMGRADES j cin gtgt examGradeij When passed as a parameter you don t specify the first array size but you need to specify the second or others if there are more why 0 C stores in row order in memory first row second row third row 0 To reference an element you need to know where each row begins EX pr0t0type void readDataint NUMGRADES int functi0n heading void readDataint gradesNUMGRADES int number Template Functions pages 911 918 We saw that we could use the same name for multiple functions provided that the functions each had a unique parameter list function overloading We might overload a function if multiple functions used the same algorithm but depended on data of different types e g DebugPrint We had to write 3 function implementations for the DebugPrint function even though the BODY of each function was identical We could have saved ourselves some typing by using a template function to overload the function A template function allows the compiler to generate the defintion of a function by allowing the type to be represented as a parameter In other words the type of the parameters is passed to the function in addition to the actual arguments for the function at the time the function is invoked From the text Function Template A C language construct that allows the compiler o generate multiple versions of a function by allowing parameterized data types Template Function Implementation angle brackets ARE part of the syntax MUST be declared globally before main template ltclass Atypegt void DebugPrint Atype data cout ltlt Debugging ltlt data ltlt endl Template Function Call angle brackets ARE part of the syntax DebugPrintltintgtvalue Example program template function implementation template ltclass Atypegt void DebugPrint Atype data cout ltlt Debugging ltlt data ltlt endl int main int value variable declarations oat average string name program statements to assign values to value average name DebugPrintltintgtvalue Debug Printlt oatgtaverage DebugPrintltstringgtname rest of the program return 0 Warmup for chapter 9 lWrite a value returning string function called MonthAbbrev that takes an int value as a parameter The parameter month represents the number of a month The function returns a string containing a three letter abbreviation for the month if 1 lt month lt 12 Otherwise it returns the string 2 Write a value returning bool function named OkMonth that takes an int value as a parameter The parameter month represents the number of a month The function returns true if K month lt12 and false otherwise 3 For each of the following write an expression for the number of times the statement X X1 is executed a forI0Ilt 10 I XXl39 b forI 0 I lt 10 I C Contra N f0fj0 j lt 10 j while Contra gt 1 X a X 1 X X 1 Contra Contra 2 d Dontra 0 e forI 0 I lt 10 I While Dontra lt 10 forj0 j lt 10 j Contra 1 K 1 While Contra lt 10 WHILE K lt j X X 1 X X 1 Contra Contra 2 K K 1 Dontra Dontra 2 4 The following program is supposed to output the average of the ve numbers on each line for all of he lines in a le What39s wrong with the code segment Change the code so it works correctly sum 0 whileindata count 1 while count lt 5 ampamp indata cin gtgt number sum sum number cout ltlt sum count ltlt endl 5 Number 6 page 300 Write a code segment that prints the days of a month in calendar format the day of the week on which the month starts is represented by an int variable startDay When startDay is zero the month begins on a Sunday The int variable days holds the number of days in a month Print a heading with the days of the week as the rst line of output The day numbers should neatly align under these column headings


Buy Material

Are you sure you want to buy this material for

25 Karma

Buy Material

BOOM! Enjoy Your Free Notes!

We've added these Notes to your profile, click here to view them now.


You're already Subscribed!

Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'

Why people love StudySoup

Bentley McCaw University of Florida

"I was shooting for a perfect 4.0 GPA this semester. Having StudySoup as a study aid was critical to helping me achieve my goal...and I nailed it!"

Jennifer McGill UCSF Med School

"Selling my MCAT study guides and notes has been a great source of side revenue while I'm in school. Some months I'm making over $500! Plus, it makes me happy knowing that I'm helping future med students with their MCAT."

Steve Martinelli UC Los Angeles

"There's no way I would have passed my Organic Chemistry class this semester without the notes and study guides I got from StudySoup."


"Their 'Elite Notetakers' are making over $1,200/month in sales by creating high quality content that helps their classmates in a time of need."

Become an Elite Notetaker and start selling your notes online!

Refund Policy


All subscriptions to StudySoup are paid in full at the time of subscribing. To change your credit card information or to cancel your subscription, go to "Edit Settings". All credit card information will be available there. If you should decide to cancel your subscription, it will continue to be valid until the next payment period, as all payments for the current period were made in advance. For special circumstances, please email


StudySoup has more than 1 million course-specific study resources to help students study smarter. If you’re having trouble finding what you’re looking for, our customer support team can help you find what you need! Feel free to contact them here:

Recurring Subscriptions: If you have canceled your recurring subscription on the day of renewal and have not downloaded any documents, you may request a refund by submitting an email to

Satisfaction Guarantee: If you’re not satisfied with your subscription, you can contact us for further help. Contact must be made within 3 business days of your subscription purchase and your refund request will be subject for review.

Please Note: Refunds can never be provided more than 30 days after the initial purchase date regardless of your activity on the site.