The program is supposed to work as follows:
- It reads a data file containing offerred course sections like sections.txt.
- Then, it allows the user to search for sections based on a course name, a
section number, or a day in a week.
On the right is a sample run (with user input in red).
Your task:
- Read the starter code hw.cpp carefully and understand what each function
does or should do. (You may want to refer to the course notes on
pass-by-reference and sorting-and-search).
- Add code in hw.cpp so that the program works correctly.
- Tip: There is no space around ','. Searching based on days needs string
manipulations (i.e., accessing each letter in a given string).
- Don't touch the main function given in the starter code.
Turn in
|
~/$ ./hw
Filename: sections.txt
> course EE301
EE301 1111 M1,TR12
EE301 2222 M2,WF12
EE301 5555 M5,TR56
> section 4040
SC112 4040 M4,WF4,T56
> day F
HE112 1001 MWF1
HE112 1002 MRF1
HE112 4001 MWF4
HE112 9001 WF9
HE112 5001 MWF5
EE301 2222 M2,WF12
EE327 3333 MWF3,R34
SC112 3000 M3,WF3,T34
SC112 4000 TRF4,W34
SC112 4040 M4,WF4,T56
SC112 8012 TR8,F12
> day R
HE112 1002 MRF1
HE112 2001 T2,R12
HE112 6001 MWR6
EE301 1111 M1,TR12
EE301 5555 M5,TR56
EE327 3333 MWF3,R34
SC112 4000 TRF4,W34
SC112 5534 MTR5,W34
SC112 8812 TR8,W12
SC112 8012 TR8,F12
> course EE327
EE327 3333 MWF3,R34
> section 3333
EE327 3333 MWF3,R34
> quit
|
|
sections.txt
|
N = 17
HE112 1001 MWF1
HE112 1002 MRF1
HE112 2001 T2,R12
HE112 4001 MWF4
HE112 9001 WF9
HE112 5001 MWF5
HE112 6001 MWR6
EE301 1111 M1,TR12
EE301 2222 M2,WF12
EE301 5555 M5,TR56
EE327 3333 MWF3,R34
SC112 3000 M3,WF3,T34
SC112 4000 TRF4,W34
SC112 4040 M4,WF4,T56
SC112 5534 MTR5,W34
SC112 8812 TR8,W12
SC112 8012 TR8,F12
|
|