Review:
-
What two Linux commands provide the visual of where you are and what files you have in your current directory?
- To create a file on Linux called hello.cpp, what do you type?
- What does the "&" do at the end of a line?
- How do you copy and paste in Linux?
- Before you run code, what two steps do you have to do first?
- If we have one file called file.cpp, how do we compile it.
New:
- Declare a twoD array of integers with 5 rows and 2 columns.
- Declare a twoD array of strings with 100 rows and 20 columns.
- Declare and initialize in one statement an array with the following contents:
1 3 4
5 6 2
- Use a nested "for" loop to cycle through the twoD array declared in question 1 and initialize all the values to 999.
- What would be the function prototype for a function called setValues that takes two arguments: a twoD integer array of size 5 x 2 and a integer value.
- What would the function call in main look like. You can use the array declared in step 1.
- Are arrays passed by value or by reference to functions? What does this mean?
- We have two .cpp files: main.cpp and myfunct.cpp and a header file called myfunct.h
- What is in myfunct.h?
- How do we tell the compiler to include the header file in main.cpp and myfunct.cpp?
- If we wanted to separately compile a file called main.cpp, what would we type?
- We want to separately compile a file called myfunct.cpp, what would we type?
- What two files have been produced from the above two compile commands?
- How do we create our executable?
Exercise:
- What will the readArray function do?
- What will the printArray function do?
- What will the sumArray function do?
- Why does the sumArray have three 2D arrays as arguments?
- What do you have to remember to "include" in both .cpp file?
- What will the name of your executable be?
- To save yourself from typing all the input, what can you do?