11.01.05
ALPHA – An Update… Finally
Time: 1 hour
Total: 60 hours
———————
Against my desire to work on NaNo today, I actually had homework todo. Almost ironically, my CS I professor assigned us a problem that read in a text file line by line and counted word frequency, which I have exanded upon minorly to produce the total number of words. I can count my words for NaNo! Yay, I won’t have to upload it every time I want a count.
Either way, it took a few hours, and I’ve come away with some valuable knowledge. First, you cannot use the C++ sort() function with STL lists (yes, thats obvious). However, you cannot use the listname.sort() member function unless your list is of objects, rather than pointers of objects. Crazy, yes?
I also experimented with operator overloading, and I msut say, it is REALLY damn spiffy. Essentially, you can define what standard C/C++ operators do to your own defined objects (++,–,+,-,*,/,==,>,< ,>=,< =). Thus you don't need to do the sloppy stuff of calling member functions to private variables. Wooty!
Also, as it turns out, my version of Cygwin doesnt like redirecting input (which, quite frankly, is alright, i don't like doing it either). In addition to the madness, the textbook was wrong (not suprising). getline() doesnt include the ending characters (\r\n or just \n). While I figured it wouldn't, I had to step through with GDB to make sure, and now I add a space at the end of the string as a delimiter like normal.
Eventually I will get back to work on my CS I final, and finish it all up. However, with NaNoWriMo, it may be a very difficult task.
Code -> http://www.nick-cash.com/download/cs1/5
Input file used for testing -> http://www.nick-cash.com/download/cs1/5/input.file
Win32 Binary -> http://www.nick-cash.com/download/cs1/5/words.exe