CPSC 111 Sections 6 and 8
Lab 8 (Tuesday, October 17)
Objectives
* Cover functions and review in/out arguments
1. Questions on lab
* Priming read
Correct IO
Incorrect IO
2. Review functions
3. Cover in/out parameters (reference parameters - address).
4. Example of pass by value
5. Example of pass by address
6. Another example of pass by reference
7. Write a program to swap to values. Write a swap function to take two integer parameters.
Write the swap function in two ways (by reference and by addresses).
For input: Assign 3 to x and 4 to y.
For output: Output x and y.
Switch their values with the one swap function.
Output x and y.
Switch their values with the other swap function.
Output x and y.
Note: Label your output!!!
8. Pseudocode and Algorithm Design
Homework:
* Below is the syntax of sendlab for the next LAB
For section 6:
sendlab.111.6 8 swapit.cpp
For section 8:
sendlab.111.8 8 swapit.cpp
* Below is the syntax for the next PROGRAM
For section 6:
handin.111.6 4 julian.cpp pseudo.txt
For section 8
handin.111.8 4 julian.cpp pseudo.txt
Programs not in the correct directory or named incorrectly will receive a grade of 0.
Back