Over The Break Challenges

New Stuff

Labs and Homework Modifications

  1. Add a command line option to the dumpit lab that allows the user to specify the width of the output. Notice that I'm using a -wX where X is the width:
  2. dumpit poem.txt -w8
    
    poem-win.txt:
           00 01 02 03  04 05 06 07
    ------------------------------------------
    000000 52 6F 73 65  73 20 61 72   Roses ar
    000008 65 20 72 65  64 2E 0D 0A   e red...
    000010 56 69 6F 6C  65 74 73 20   Violets 
    000018 61 72 65 20  62 6C 75 65   are blue
    000020 2E 0D 0A 53  6F 6D 65 20   ...Some 
    000028 70 6F 65 6D  73 20 72 68   poems rh
    000030 79 6D 65 2E  0D 0A 42 75   yme...Bu
    000038 74 20 6E 6F  74 20 74 68   t not th
    000040 69 73 20 6F  6E 65 2E 0D   is one..
    000048 0A                         .
    
    dumpit poem.txt -w24
    
    poem-win.txt:
           00 01 02 03 04 05 06 07 08 09 0A 0B  0C 0D 0E 0F 10 11 12 13 14 15 16 17
    ----------------------------------------------------------------------------------------------------------
    000000 52 6F 73 65 73 20 61 72 65 20 72 65  64 2E 0D 0A 56 69 6F 6C 65 74 73 20   Roses are red...Violets 
    000018 61 72 65 20 62 6C 75 65 2E 0D 0A 53  6F 6D 65 20 70 6F 65 6D 73 20 72 68   are blue...Some poems rh
    000030 79 6D 65 2E 0D 0A 42 75 74 20 6E 6F  74 20 74 68 69 73 20 6F 6E 65 2E 0D   yme...But not this one..
    000048 0A                                                                         .
    
    Also, be able to handle multiple files on the command line (hint: use argc and argv)
    dumpit foo.txt bar.txt baz.txt
    
    as well as:
    dumpit *.txt -w32
    
    You can download a compiled version here. It's not super-intelligent, as there can be no spaces between the -w and the value X.

    Much more intelligent ones are here: A Windows version (dumpit.exe), a Linux version (dumpit), and a MacOS version (dumpit-mac). These do multiple files on the command line as well as color.

    Just type:

    dumpit --help
    
    to see the options:
    Usage: dumpit [options] [file1 file2 ...] 
    
    Options:
     -w  --width    How wide the output is (default is 16 chars).
     -c  --color    Use colorized output.
     -h  --help     Display this information.
    
    If no input files are specified, read from stdin.
    

  3. For the spellcheck assignment, read all of the words into a dynamically-allocated array at startup and use this array to check the words. It will be much faster because you don't have to keep opening/reading/closing the file for each word. Better yet, use a linked-list. You don't know how many words might be in the dictionary. The array and list will be automatically sorted. Use a binary search through the array and a linear search through the linked-list.
  4. For the palindrome assignment, modify your code to handle punctuation and upper/lower case characters. For example, you should be able to verify that these are palindromes:
    Not a tub, but a ton
    Madam, I'm Adam
    Go hang a salami, I'm a lasagna hog
    
  5. From the calendar lab: In addition to the other suggestions that were given in the lab description, print a whole year instead of just one month:
                                2016
          January               February               March          
    Su Mo Tu We Th Fr Sa  Su Mo Tu We Th Fr Sa  Su Mo Tu We Th Fr Sa  
                    1  2      1  2  3  4  5  6         1  2  3  4  5  
     3  4  5  6  7  8  9   7  8  9 10 11 12 13   6  7  8  9 10 11 12  
    10 11 12 13 14 15 16  14 15 16 17 18 19 20  13 14 15 16 17 18 19  
    17 18 19 20 21 22 23  21 22 23 24 25 26 27  20 21 22 23 24 25 26  
    24 25 26 27 28 29 30  28 29                 27 28 29 30 31        
    31                                                                
    
           April                  May                   June          
    Su Mo Tu We Th Fr Sa  Su Mo Tu We Th Fr Sa  Su Mo Tu We Th Fr Sa  
                    1  2   1  2  3  4  5  6  7            1  2  3  4  
     3  4  5  6  7  8  9   8  9 10 11 12 13 14   5  6  7  8  9 10 11  
    10 11 12 13 14 15 16  15 16 17 18 19 20 21  12 13 14 15 16 17 18  
    17 18 19 20 21 22 23  22 23 24 25 26 27 28  19 20 21 22 23 24 25  
    24 25 26 27 28 29 30  29 30 31              26 27 28 29 30        
                                                                      
    
            July                 August              September        
    Su Mo Tu We Th Fr Sa  Su Mo Tu We Th Fr Sa  Su Mo Tu We Th Fr Sa  
                    1  2      1  2  3  4  5  6               1  2  3  
     3  4  5  6  7  8  9   7  8  9 10 11 12 13   4  5  6  7  8  9 10  
    10 11 12 13 14 15 16  14 15 16 17 18 19 20  11 12 13 14 15 16 17  
    17 18 19 20 21 22 23  21 22 23 24 25 26 27  18 19 20 21 22 23 24  
    24 25 26 27 28 29 30  28 29 30 31           25 26 27 28 29 30     
    31                                                                
    
          October               November              December        
    Su Mo Tu We Th Fr Sa  Su Mo Tu We Th Fr Sa  Su Mo Tu We Th Fr Sa  
                       1         1  2  3  4  5               1  2  3  
     2  3  4  5  6  7  8   6  7  8  9 10 11 12   4  5  6  7  8  9 10  
     9 10 11 12 13 14 15  13 14 15 16 17 18 19  11 12 13 14 15 16 17  
    16 17 18 19 20 21 22  20 21 22 23 24 25 26  18 19 20 21 22 23 24  
    23 24 25 26 27 28 29  27 28 29 30           25 26 27 28 29 30 31  
    30 31                                                            
    

  6. From the jumble assignment: Given this encrypted string (a quote from a movie), try to crack the password and figure out the quote:
    ÉÛÖ™ØÑÚՙàÐÞ µÜÂÞŒÈÞՐåÐîÑŒÕèÆœŒÃÞÍÙÑ×ށÝя™µØÑÓށÑÞÆ™ØÑåÔ¥´áÅޏÅÐîÔÛϠՐãÂçÏÑŒÌçÐçŒÂÛÐåàâÕœŒÃÞÍÙÑ×ށÝя	
    
    Depending on the browser, you may see different characters here. I've included a main file called guessme.c with this text to get you started: HTML Text.

    And not to be repetitive, but you MUST download the text file. Don't copy the text from the webpage or you'll be sorry.

    1. Hint: The password contains 5 lower-case characters, a..z. (This will make it somewhat easier to figure out.)
    2. There are 11,881,376 possible passwords. (265 = 26 * 26 * 26 * 26 * 26)
    3. Everything you need to know to solve this has been covered in class this semester.
    4. The truly advanced students will be able to get it with no hints. (You have to be resourceful.)
      • How will you know you have cracked it without having to look at every decoded string?
    5. For those that want the true challenge, try to solve it without looking at the hint.
    6. For a non-high-tech challenge, who said it?