18 Pages

17-multiDimensionalArrays

Course: CSCE 110, Fall 2009
School: Texas A&M
Rating:
 
 
 
 
 

Word Count: 677

Document Preview

Arrays CSCE Multi-Dimensional 110 From James Tams material J. Michael Moore When To Use Arrays Of Different _______________ Determined by the data the number ____________________ ___________ determines the number ______________ to use. Examples: (1D array) Tracking grades for a class Each cell contains the grade for a student i.e., grades[i] There is _________________ that specifies which students grades are...

Register Now

Unformatted Document Excerpt

Coursehero >> Texas >> Texas A&M >> CSCE 110

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.
Arrays CSCE Multi-Dimensional 110 From James Tams material J. Michael Moore When To Use Arrays Of Different _______________ Determined by the data the number ____________________ ___________ determines the number ______________ to use. Examples: (1D array) Tracking grades for a class Each cell contains the grade for a student i.e., grades[i] There is _________________ that specifies which students grades are being accessed One dimension (which student) (2D array) Expanded grades program Again there is ____________ that specifies which students grades are being accessed The __________________ can be used to specify which lab assignment J. Michael Moore When To Use Arrays Of Different Dimensions (2D array continued) Student Lab grade First Second Third student student student Lab1 Lab2 Lab3 Lab4 Lab5 : LabN J. Michael Moore When To Use Arrays Of Different Dimensions (2D array continued) A _________ is an Notice that each row is merely a _________ array containing rows of _________ Columns [1] [2] [3] [4] [1] [2] [3] Rows [4] [5] J. Michael Moore When To Use Arrays Of Different Dimensions (3D array take the ________ but allow for multiple ______). The _______________________ specifies which section grades are being tracked. Section (Z) Student (X = column) Note: Lab Assignment (Y = row) 1.The standard approach for specifying the dimensions is to specify the row coordinate (Y) and then the column coordinate (X). 2.The size of a _________ must be the same for all elements along that _______ e.g., all ____ must be of the same ____ J. Michael Moore When To Use Arrays Of Different Dimensions Section 503 Section 502 Section 501 Student 1 Student 2 Student 3 Lab1 Lab2 Lab3 Lab4 Lab5 Lab6 Lab7 J. Michael Moore Declaring Multi-Dimensional Arrays Format: (Two dimensional arrays) Name : array [min..max, min..max] of type; _____ _______ (Three dimensional arrays) Name : array [min..max, min..max, min..max] of type; Examples: var johnFinances : array [1..3, 1..7] of real; var cube : array [1..6, 1..6, 1..6] of char; J. Michael Moore Declaring Multi-Dimensional Arrays As A Type Format: Type declaration Type name = array [min..max, min..max] of element type; name = array [min..max, min..max, min..max] of element type; Variable declaration array name : Type name; J. Michael Moore Declaring Multi-Dimensional Arrays As A Type Example: Type declaration Finances = array [1..3, 1..7] of real; Cube = array 1..6, [1..6, 1..6] of char; Variable declaration var johnFinances : Finances; var aCube : Cube; J. Michael Moore Accessing / Assigning Values To Elements Format: name [row][column] := value; Example: finances [1][1] := 4500; writeln (finances[1][1]); OR finances [1, 1] := 4500; writeln (finances[1, 1]); J. Michael Moore Multi-Dimensional Arrays And Input/Output Arrays of ___________________ (including multi-dimensional _________________ arrays) cannot be passed as parameters to: read, readln, write, writeln. Only ______________________ can be passed as parameters to these procedures. J. Michael Moore A Character-Based Grid program gridExample (input, output); const MAX_ROWS = 4; MAX_COLUMNS = 4; NUM_COMBINATIONS = 10; type Grid = array[1..MAX_ROWS, 1..MAX_COLUMNS] of char; J. Michael Moore A Character-Based Grid (2) function generateElement (temp : integer) : char; var anElement : char; begin case (temp) of 1, 2, 3, 4, 5, 6 : anElement := ' '; 7, 8, 9: anElement := '*'; 10: anElement := '.'; J. Michael Moore A Character-Based Grid (3) else {still in case statement} begin writeln('<< Error with the random # generator.>>'); writeln('<< Value should be 1-',NUM_COMBINATIONS, ' but random value is ', temp); anElement := '!'; end; end; generateElement := anElement; end; J. Michael Moore A Character-Based Grid procedure initialize (var aGrid : Grid); var r : integer; c : integer; temp : integer; begin for r := 1 to MAX_ROWS do begin for c := 1 to MAX_COLUMNS do begin temp := random(NUM_COMBINATIONS) + 1; aGrid[r][c] := generateElement(temp); end; end; end; J. Michael Moore A Character-Based Grid (5) procedure display (aGrid : Grid); var row: integer; column: integer; begin for row := 1 to MAX_ROWS do begin for column := 1 to MAX_COLUMNS do begin write(aGrid[row][column]); end; writeln; end; end; J. Michael Moore A Character-Based Grid (6) procedure displayLines (aGrid : Grid); var row : integer; column : integer; begin for row := 1 to MAX_ROWS do begin writeln(' - - - -'); for column := 1 to MAX_COLUMNS do begin write('|', aGrid[row][column]); end; writeln('|'); end; writeln(' - - - -'); end; J. Michael Moore A Character-Based Grid (7) begin var aGrid : Grid; initialize(aGrid); writeln('Displaying grid'); writeln('==============='); display(aGrid); writeln; writeln('Displaying grid with bounding lines'); writeln('=========================='); displayLines(aGrid); end. J. Michael Moore
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:

Texas A&M - CSCE - 110
RecordsCSCE 110From James Tam's materialJ. Michael MooreTracking InformationExample, storinginformation about aclient: First namearray or String Last namearray or String Phone numberinteger, array or String Addressarray or String Postal co
Texas A&M - CSCE - 110
RecursionCSCE 110From James Tams materialJ. Michael MooreWhat Is Recursion?the determination of a succession of elements (as numbers orfunctions) by operation on one or more preceding elementsaccording to a rule or formula involving a finite number
Texas A&M - CSCE - 110
Searching &amp; SortingCSCE 110J. Michael MooreSearching with Linear SearchMany times, it is necessary to search an array to find aparticular entry.To study the basics of this issue, we will look at an array of_ integers (I.e. no _) and search for apa
Texas A&M - CSCE - 110
Object OrientedProgramming:An IntroductionCSCE 110J. Michael MooreProcedural/FunctionalProgrammingObject OrientedProgramming Pascal is an example Focus is on the stepsfrom beginning to endusing A different_ onprogramming Focus on &quot;_&quot;and t
Texas A&M - CSCE - 110
JavascriptA primer based on PascalJavascript Technically called ECMAScript Most Javascript is used on web pages. NOT like Java. (But designed to look likeJava!) Uses DOM (Document Object Model) foran HTML page Event driven Looks similar to many
Texas A&M - CSCE - 110
Exam 1CSCE 110Page 1 of 12Form AYou have 60 minutes to complete this exam.There are 48 multiple choice questions worth 2 points each unless otherwise specified.1.In Pascal, the relational operator not equal is represented by:A) B) &lt;&gt;C) !=D) not
Texas A&M - CSCE - 110
Exam 1CSCE 110Page 1 of 12Form BYou have 60 minutes to complete this exam.There are 48 multiple choice questions worth 2 points each unless otherwise specified.1.What is the output of the following program?1Program FindTheRightOutput;Beginvar a
Texas A&M - CSCE - 110
Exam 2CSCE 110 Fall 2009Page 1 of 15Form AYou have 65 minutes to complete this exam.50 questions worth 2 points each.Assume code fragments are placed into a complete program in such a way that the program will compile (Note:errors within the code f
Texas A&M - CSCE - 110
Exam 2CSCE 110 Fall 2009Page 1 of 15Form BYou have 65 minutes to complete this exam.50 questions worth 2 points each.Assume code fragments are placed into a complete program in such a way that the program will compile (Note:errors within the code f
Texas A&M - CSCE - 110
Exam IIICSCE 110 (3:55 PM)Page 1Form AYou have 50 minutes to complete this exam.There are 39 multiple choice questions worth 2 points each unless otherwise specified.1.It is sometimes appropriate to pass an array to a procedure as a var parameter e
Texas A&M - CSCE - 110
Exam IIICSCE 110 (3:55 PM)Page 1Form BYou have 50 minutes to complete this exam.There are 39 multiple choice questions worth 2 points each unless otherwise specified.1.(3 points) What is the purpose of the reset statement when dealing with text fil
GWU - REL - 305
Chapter 1An Overview of the New TestamentKey Topics/ThemesNew Testament: twenty-seven documentsFour GospelsA church historyLettersAn apocalypseOther Christian documentsDiversity of early Jesus movement 2009 McGraw-Hill Higher Education. All righ
GWU - REL - 305
Chapter 19General Letters on Faith and Behavior:Hebrews, the Catholic Epistles, and theNoncanonical Teachings (Didache) of theTwelve ApostlesKey Topics/ThemesGeneral epistles portray Gods revelationthrough Jesus as final and completeHebrews: Jesus
GWU - REL - 305
Chapter 2How the New Testament WasFormed and Handed Down to UsKey Topics/ThemesMany Christian books written during NewTestament period (c. 50-140 CE) notaccepted into canonProcess of canonizationComparison/analysis of manuscriptsDevelopment of En
GWU - REL - 305
Chapter 3The Diverse World ofFirst-Century JudaismKey Topics/ThemesThe diversity of first-century JudaismCommon beliefs of first-century Jews 2009 McGraw-Hill Higher Education. All rights reserved.2Three Worlds of the NewTestament EraScriptures
GWU - REL - 305
Chapter 4The World of GreekThought and CultureKey Topics/ThemesEarly Christianity rapidly expanded into surroundingGreco-Roman worldInterpreted by Gentile converts in light of Hellenisticthought and culture 2009 McGraw-Hill Higher Education. All r
GWU - REL - 305
Chapter 5The World of Roman Political PowerKey Topics/ThemesThe division of Alexanders empire after hisdeathThe influence of Rome in Palestine 2009 McGraw-Hill Higher Education. All rights reserved.2Alexander and His SuccessorsThe conquests of Al
GWU - REL - 305
Chapter 6The Gospels: Form and PurposeKey Topics/ThemesThe similarity of the Synoptic GospelsThe uniqueness of the Gospel of JohnThe diverse views about Jesus presentedin the New Testament Gospels 2009 McGraw-Hill Higher Education. All rights reser
GWU - REL - 305
Chapter 7Marks Portrait of Jesus: The HiddenMessiah and Eschatological JudgeKey Topics/ThemesMark the earliest GospelPortrays Jesus as hidden MessiahJesus role: to serve, suffer, and die 2009 McGraw-Hill Higher Education. All rights reserved.2Mar
GWU - REL - 305
Chapter 9Lukes Portrait of Jesus:A Savior for All NationsKey Topics/ThemesPart one of a two-volume workChristianity as a universal world faithInnocence of Jesus and his followersRadical reversal of social orderInsertion of two new bodies of materi
GWU - REL - 305
Chapter 10Johns Portrait of Jesus:Divine Wisdom Made FleshKey Topics/ThemesJohn as different from the SynopticsJesus as the Word made fleshJesus crucifixion as glorificationChrist eternally present in the Paraclete 2009 McGraw-Hill Higher Educatio
GWU - REL - 305
Chapter 11The Other Gospels:Additional Portraits of JesusKey Topics/ThemesDiversity of Gospels produced in earlyChristian periodReflect great diversity of views about natureof Jesus and his messageThree classes of early, noncanonical Gospels 2009
GWU - REL - 305
Chapter 12The Continuing Questfor the Historical JesusKey Topics/ThemesFormidable challenge of distinguishing Jesusof history from Christ of faithCriteria for recovering authentic words anddeeds of JesusScholarly differences regarding Jesus selfid
GWU - REL - 305
Chapter 13Acts of the ApostlesKey Topics/ThemesA continuation of Lukes two-part narrativeof Christian originsEmphasizes same themes of Luke 2009 McGraw-Hill Higher Education. All rights reserved.2IntroductionVolume two of Lukes two-volume narrati
GWU - REL - 305
Chapter 14Paul: Apostle to the NationsKey Topics/ThemesPaul second only to Jesus as contributor toearly ChristianityPaul motivated by experience of a revelationof Jesus ChristCreator and disseminator of influential viewof Jesus cosmic significance
GWU - REL - 305
Chapter 15Unity, Freedom, and Christs Return:Pauls Letters toThessalonica and CorinthKey Topics/Themes1 ThessaloniansNearness of the eschatonWarnings against attempting to calculate date ofthe Parousia1 CorinthiansPauls aims to heal divisions in
GWU - REL - 305
Chapter 16Freedom from Law and Justification byFaith: Galatians and RomansKey Topics/ThemesPauls attempt to define Christianitys relationto JudaismAll humanity imitates Adams disobedienceand is condemnedOnly Gods grace in Christ can reconcilehuma
GWU - REL - 305
Chapter 17Letters from Prison:Philippians and PhilemonKey Topics/ThemesPhilippians: an uncommonly warmPauline letterPhilemon: an implicit acceptance ofslavery while stressing that Christian unitysupercedes social class 2009 McGraw-Hill Higher Edu
GWU - REL - 305
Chapter 20Continuing the Apocalyptic Hope:The Book of Revelation and OtherJewish/Christian Apocalyptic WorksKey Topics/ThemesRevelationExpresses hope for imminent transformation ofworldAssures faithful of the completion of Godsprearranged planOt
GWU - REL - 305
Chapter 21The Judeo-Christian Bibleand Subsequent HistoryEvolution of the Hebrew Bible andthe Christian Greek ScripturesEvolution of Hebrew biblical canonCompleted by late first century CEInfluenced by rabbis at JamniaHebrew biblical canon ends at
GWU - REL - 305
Chapter 8Matthew's Portrait of Jesus:A Teacher Greater than MosesKey Topics/ThemesMatthew an abbreviation of MarkFive blocks of teaching materialJesus as inaugurator of a New CovenantJesus as interpreter of Mosaic LawJesus as fulfiller of messiani
GWU - REL - 305
Chapter 18Continuing the Pauline Tradition:2 Thessalonians, Colossians, Ephesians,2 Thessalonians, Colossians, Ephesians, the PastoralEpistles, and Other Early Christian Writings Influenced byPauline ThoughtKey Topics/ThemesLetters written in Pauls
GWU - ACC - 400
CHAPTER 12The Production Cycle 2008 Prentice Hall Business PublishingAccounting Information Systems, 11/eRomney/Steinbart1 of 122INTRODUCTION Questions to be addressed in this chapterinclude: What are the basic business activities and dataproce
GWU - ACC - 400
CHAPTER 1Accounting InformationSystems:An Overview 2008 Prentice Hall Business PublishingAccounting Information Systems, 11/eRomney/Steinbart1 of 85INTRODUCTION Questions to be addressed in this chapterinclude: What is the meaning of system, d
GWU - ACC - 400
CHAPTER 2Overview of BusinessProcesses 2008 Prentice Hall Business PublishingAccounting Information Systems, 11/eRomney/Steinbart1 of 119INTRODUCTION Questions to be addressed in this chapterinclude: What are the basic business processes in whi
GWU - ACC - 400
CHAPTER 3Systems Development andDocumentation Techniques 2008 Prentice Hall Business PublishingAccounting Information Systems, 11/eRomney/Steinbart1 of 136INTRODUCTION Questions to be addressed in this chapterinclude: What is the purpose of doc
GWU - ACC - 400
CHAPTER 4Relational Databases 2008 Prentice Hall Business PublishingAccounting Information Systems, 11/eRomney/Steinbart1 of 96INTRODUCTION Questions to be addressed in this chapter: How are databases different than file-based legacysystems? Wh
GWU - ACC - 400
CHAPTER 5Computer Fraud and Abuse 2008 Prentice Hall Business PublishingAccounting Information Systems, 11/eRomney/Steinbart1 of 175INTRODUCTION Questions to be addressed in this chapter: What is fraud, and how are fraudsperpetrated? Who perpet
GWU - ACC - 400
CHAPTER 6Control and AccountingInformation Systems 2008 Prentice Hall Business PublishingAccounting Information Systems, 11/eRomney/Steinbart1 of 315INTRODUCTION Questions to be addressed in this chapter: What are the basic internal control conc
GWU - ACC - 400
CHAPTER 9Auditing Computer-BasedInformation Systems 2008 Prentice Hall Business PublishingAccounting Information Systems, 11/eRomney/Steinbart1 of 151INTRODUCTION Questions to be addressed in this chapterinclude: What are the scope and objectiv
GWU - ACC - 400
CHAPTER 10The Revenue Cycle:Sales to Cash Collections 2008 Prentice Hall Business PublishingAccounting Information Systems, 11/eRomney/Steinbart1 of 160INTRODUCTION Questions to be addressed in this chapterinclude: What are the basic business a
GWU - ACC - 400
CHAPTER 11The Expenditure Cycle:Purchasing to CashDisbursements 2008 Prentice Hall Business PublishingAccounting Information Systems, 11/eRomney/Steinbart1 of 122INTRODUCTION Questions to be addressed in this chapterinclude: What are the basic
Texas A&M - MATH - 411
Texas A&amp;M UniversityDepartment of MathematicsVolodymyr NekrashevychFall 2011Math 411 Problem Set 1Issued: 09.02Due: 09.091.1. Two dice are rolled. What is the probability that (a) the two numberswill dier by 1 or less and (b) the maximum of the tw
Texas A&M - MATH - 411
Texas A&amp;M UniversityDepartment of MathematicsVolodymyr NekrashevychFall 2011Math 411 Problem Set 2Issued: 09.09Due: 09.162.1. A bet is said to carry 3 to 1 odds if you win $3 for each $1 you bet.What must the probability of winning be for this to
Texas A&M - MATH - 411
Texas A&amp;M UniversityDepartment of MathematicsVolodymyr NekrashevychFall 2011Math 411 Problem Set 3Issued: 09.16Due: 09.233.1. A tourist wants to visit six of Americas ten largest cities. In howmany ways can she do this if the order of her visits i
Texas A&M - MATH - 411
Texas A&amp;M UniversityDepartment of MathematicsVolodymyr NekrashevychFall 2011Math 411 Problem Set 4Issued: 09.23Due: training4.1. If we ip a coin 5 times, what is the probability that the number ofheads is an even number?4.2. Three students each h
Texas A&M - MATH - 411
Texas A&amp;M UniversityDepartment of MathematicsVolodymyr NekrashevychFall 2011Math 411 Problem Set 5Issued: 10.08Due: 10.145.1. Two events have P (A) = 1/4, P (B |A) = 1/2, and P (A|B ) = 1/3.Compute P (A B ), P (B ), and P (A B ).5.2. A friend ips
Texas A&M - MATH - 411
Texas A&amp;M UniversityDepartment of MathematicsVolodymyr NekrashevychFall 2011Math 411 Problem Set 6Issued: 10.17Due: 10.246.1. A group of 20 people go out to dinner. 10 go to an Italian restaurant,6 to a Japanese, and 4 to a French restaurant. The
Texas A&M - MATH - 411
Texas A&amp;M UniversityDepartment of MathematicsVolodymyr NekrashevychFall 2011Math 411 Problem Set 7Issued: 10.24Due: training7.1. Suppose 60% of the people subscribe to newspaper A, 40% to newspaper B, and 30% to both. If we pick a person at random
Texas A&M - MATH - 411
Texas A&amp;M UniversityDepartment of MathematicsVolodymyr NekrashevychFall 2011Math 411 Problem Set 8Issued: 11.01Due: 11.098.1. Suppose X has density function f (x) for a x b and Y = cX + d,where c &gt; 0. Find the density function of Y .8.2. Suppose
Texas A&M - MATH - 411
Texas A&amp;M UniversityDepartment of MathematicsVolodymyr NekrashevychFall 2011Math 411 Problem Set 9Issued: 11.15Due: 11.239.1. 20 people get on an elevator on the rst oor of a seven-story building.Each gets o at one of the six higher oors chosen at
Texas A&M - MATH - 411
Texas A&amp;M UniversityDepartment of MathematicsVolodymyr NekrashevychFall 2011Math 411 Problem Set 10Issued: 11.29Due: training10.1. Show that if X is exponential(1), then Y = X/ is exponential().10.2. Suppose that X and Y have joint density f (x, y
Texas A&M - MATH - 409
Texas A&amp;M UniversityDepartment of MathematicsVolodymyr NekrashevychFall 2011MATH 308 Homework 99.1. Find the fundamental matrix (t) = eAt satisfying (0) = I for the systemx=3 22 2x.4 28 4x.9.2. Find the general solution of the systemx=9.3.
Texas A&M - MATH - 409
Texas A&amp;M UniversityDepartment of MathematicsVolodymyr NekrashevychFall 2011MATH 308 Homework 1010.1. Determine the radius of convergence of the power series2n xn .n=010.2. Find the rst ve terms of the power series solution y (x) = an xn of the in
Texas A&M - MATH - 409
Texas A&amp;M UniversityDepartment of MathematicsVolodymyr NekrashevychFall 2011MATH 308 Homework 1111.1. Find the general solution of the systemx=211 2x.11.2. Find the general solution of the system100x = 2 1 2 x .321Express it in terms of r
Texas A&M - MATH - 409
Texas A&amp;M UniversityDepartment of MathematicsVolodymyr NekrashevychFall 2011MATH 308 Homework 11.1. Sketch a direction eld for the dierential equationy = 1 + 2y.Based on the direction eld, determine the behavior of y as t . If this behaviordepends
Texas A&M - MATH - 409
Texas A&amp;M UniversityDepartment of MathematicsVolodymyr NekrashevychFall 2011MATH 308 Homework 22.1. Find the general solution of the equationy + y 2 sin x = 0.2.2. Find the general solution of the equationy=x ex.y + ey2.3. Find the solution of
Texas A&M - MATH - 409
Texas A&amp;M UniversityDepartment of MathematicsVolodymyr NekrashevychFall 2011MATH 308 Homework 33.1. Determine whether the equation(3x2 2xy + 2) dx + (6y 2 x2 + 3) dy = 0is exact. If it is exact, nd the general solution.3.2. Find the value of b for
Texas A&M - MATH - 409
Texas A&amp;M UniversityDepartment of MathematicsVolodymyr NekrashevychFall 2011MATH 308 Homework 44.1. Consider the initial value problem3y y = 2et ,2y (0) = y0 .Find the value of y0 that separates solutions that grow positively ast from those tha
Texas A&M - MATH - 409
Texas A&amp;M UniversityDepartment of MathematicsVolodymyr NekrashevychFall 2011MATH 308 Homework 55.1. Find the solution of the initial value problemy 2y + y = tet + 4,y (0) = 1,y (0) = 1.Plot it using MatLab. (Try to choose a nice interval [0, T ]
Texas A&M - MATH - 409
Texas A&amp;M UniversityDepartment of MathematicsVolodymyr NekrashevychFall 2011MATH 308 Homework 66.1. Find the inverse Laplace transform of F (s) =2s3.s2 +2s+106.2. Use the Laplace transform to solve the initial value problem y 4y + 4y = 0,y (0) =