~/$ ./part1 Input file is: in00.txt Count is 8 the a cat dog sounds is smelly flatulent ~/$ ./part1 Input file is: in01.txt Count is 23 a let my ring of the fire truth way is that a better scary golden ring the left sight ring out highway alone ~/$ ./part1 Input file is: asdf Error! File 'asdf' not found!
submit: ~/bin/submit -c=IC210 -p=lab12 part1.cpp
(word value).
If you do this elegantly, you'll make a new struct for
representing pairs and make that the type of data
rather than mucking up Node with multiple data
members representing "the data". This reinforces the
fundamental idea that linked lists are the same no matter what
kind of data you put in them.
~/$ ./part2 Input file is: in02.txt count is 8 (the 1) (a 1) (cat 2) (dog 2) (sounds 2) (is 1) (smelly 3) (flatulent 5) ~/$ ./part2 Input file is: in03.txt count is 23 (a 1) (let 3) (my 2) (ring 3) (of 1) (the 1) (fire 3) (truth 3) (way 2) (is 1) (that 1) (a 1) (better 3) (scary 4) (golden 4) (ring 3) (the 1) (left 2) (sight 3) (ring 3) (out 2) (highway 4) (alone 3)
submit: ~/bin/submit -c=IC210 -p=lab12 part1.cpp part2.cpp
~/$ ./part3 Input file is: in04.txt Before is: Current is: (the 1) Number after is: 3 [a]ccept or [r]eject: a Before is: (the 1) Current is: (dog 2) Number after is: 2 [a]ccept or [r]eject: a Before is: (the 1) (dog 2) Current is: (is 1) Number after is: 1 [a]ccept or [r]eject: a Before is: (the 1) (dog 2) (is 1) Current is: (smelly 3) Number after is: 0 [a]ccept or [r]eject: a List is: (the 1) (dog 2) (is 1) (smelly 3)
submit: ~/bin/submit -c=IC210 -p=lab12 part1.cpp part2.cpp part3.cpp lab12.h lab12.cpp
~/$ ./part4 Input file is: in04.txt Before is: Current is: (the 1) Number after is: 3 [a]ccept or [r]eject: a Before is: (the 1) Current is: (dog 2) Number after is: 2 [a]ccept or [r]eject: a Before is: (the 1) (dog 2) Current is: (is 1) Number after is: 1 [a]ccept or [r]eject: a Before is: (the 1) (dog 2) (is 1) Current is: (smelly 3) Number after is: 0 [a]ccept or [r]eject: a List is: the dog is smelly Score is: 7
submit: ~/bin/submit -c=IC210 -p=lab12 part1.cpp part2.cpp part3.cpp lab12.h lab12.cpp part4.cpp
Note: you have two choices for making this work. The first is to actually remove the node for the [r]ejected word from the list. The second is to keep a separate list consisting of the [a]ccepted words. Both have their challenges!
~/$ ./part5 Input file is: in02.txt Before is: Current is: (the 1) Number after is: 7 [a]ccept or [r]eject: a Before is: the Current is: (a 1) Number after is: 6 [a]ccept or [r]eject: r Before is: the Current is: (cat 2) Number after is: 5 [a]ccept or [r]eject: r Before is: the Current is: (dog 2) Number after is: 4 [a]ccept or [r]eject: a Before is: the dog Current is: (sounds 2) Number after is: 3 [a]ccept or [r]eject: a Before is: the dog sounds Current is: (is 1) Number after is: 2 [a]ccept or [r]eject: r Before is: the dog sounds Current is: (smelly 3) Number after is: 1 [a]ccept or [r]eject: r Before is: the dog sounds Current is: (flatulent 5) Number after is: 0 [a]ccept or [r]eject: a List is: the dog sounds flatulent Score is: 10
submit: ~/bin/submit -c=IC210 -p=lab12 part1.cpp part2.cpp part3.cpp lab12.h lab12.cpp part4.cpp part5.cpp