This is a warm-up and exploratory first CSE 330 lab. Work on the exercises in the order given, and see how far you get. You may ask basic C++ questions and get some help with debugging, but overall you should try to manage with minimal help. Each warms up at their own pace.
Exercise 1: Write a complete C++ program which reads in an odd number of integer values. These values are to be stored in a vector<int>. Among the stored values there should be no repeated values. The stored values should be contained in the vector should not be ordered.
Task: The program is to determine the median element in the vector; it should do so without prior sorting of the vector.
Exercise 2: You may simply add on to your program of Exercise 1 Write a function which will print out the values of a vector<int> without any iteration. That is, your function is not allowed to use any for-, while-, or do-while loops.
Exercise 3: Again, you can simply add on the existing program Write a function which will return the maximal value of a vector<int>. Again, the function is not allowed to use iteration (loops).
To obtain credit for this lab:
- Before you leave the lab (not before 3pm), sign off on a signup sheet that will be passed around.
- A portal will be opened Lab 1; electronically submit your best effort (in a single .cpp file) for this lab by 11:59pm of the day following the lab (M W, W F).
Your electronic submission will not be graded in a traditional sense, but in order to obtain full credit for the lab, your submission should show a substantial and sincere effort on your part.
Reviews
There are no reviews yet.