Name: ____________________________________________________ Alpha: _____________
Section: ________
Describe help received: _________________________________________________________________
See the bottom for how to submit your work.
Due: Before 0800 on next class day
- (10 pts) Read today's lecture notes. Honestly declare
how you read the notes.
- (10 pts) I read the notes carefully. I have a good understanding of the topics therein.
- (10 pts) I read the notes carefully, but I don't really understand the following points well:
- (0 pts) I didn't read the notes carefully.
- [10pts]
Assume that the usual
selection_sort function has already been
defined for arrays of integers. (You can assume that all numbers that we
consider are greater than or equal to 0.) Define a before()
function so that the numbers may be ordered as follows:
- The numbers should be ordered by their last digit in the descending
order.
- The numbers with the same last digit should be ordered by their actual values
in the ascending order.
For example,
- 76 should be ordered before 192, since the last digit of 76 is 6,
and that of 192 is 2.
- 192 should be ordered before 1102. They
both have the same last digit 2, but 1102 is larger.
- The numbers
45 32 12 42 0 18 6 should be ordered as
18 6 45 12 32 42 0.
- [80pts] Write a program hw.cpp so that
it reads 10 positive
ints from the user and prints them
in order as follows:
- All the odd numbers come first (in increasing order)
- All the even numbers come next (in increasing order)
An example run:
~/$ ./hw
18 2 7 14 29 3 5 8 16 11
3 5 7 11 29 2 8 14 16 18
Submit to the submission server (due: 0800 on the next class day)
~/bin/submit -c=IC210 -p=hw25 hw.cpp
Bring to class
- A printout of this homework sheet annotated with your answers
- The codeprint of hw.cpp.