5
Data Structure CS 322

Data Structure CS 322. What is an array? Initializing arrays Accessing the values of an array Multidimensional arrays LAB#1 : Arrays

Embed Size (px)

Citation preview

Page 1: Data Structure CS 322. What is an array? Initializing arrays Accessing the values of an array Multidimensional arrays LAB#1 : Arrays

Data StructureCS 322

Page 2: Data Structure CS 322. What is an array? Initializing arrays Accessing the values of an array Multidimensional arrays LAB#1 : Arrays

• What is an array?• Initializing arrays• Accessing the values of an array• Multidimensional arrays

LAB#1 : Arrays

Page 3: Data Structure CS 322. What is an array? Initializing arrays Accessing the values of an array Multidimensional arrays LAB#1 : Arrays

LAB#1

Exercise#1:Write a C++ program that defines array Billy with the elements (16, 2, 77, 40, and 12071) of type integer, then print the sum of all elements.

Page 4: Data Structure CS 322. What is an array? Initializing arrays Accessing the values of an array Multidimensional arrays LAB#1 : Arrays

LAB#1

Exercise#2:Write a C++ program that defines array jimmy for representing the elements as shown in the graph below.

Page 5: Data Structure CS 322. What is an array? Initializing arrays Accessing the values of an array Multidimensional arrays LAB#1 : Arrays

LAB#1

Exercise#3:Write a C++ program to define array b of type INT with 2 rows and 4 columns. Then print the array row by row. The program should set column 4 to zero and print the new array.