CS 202 - Homework 2 - 9/17/07

Due: Monday, 9/24/07, in class (or by 2pm the latest)

This assignment has a written part and a programming part. Please hand in printouts of your programs together with your written answers. On the first page, please write your own name as well as the names of the students with whom you collaborated.
  1. Martin, chapter 2, problems

  2. Write two C programs to convert a number from any base to decimal and vice versa. Skeletons for both programs are provided in my directory ~schar/cs202/hw2/ on benjerry: Sample executables are provided in the same directory, but these are restricted to bases 7 and 13. Once your program works, you should make sure that you get the same output for these bases. (Of course, test your program for other bases as well!) To work on this assignment, copy my directory 'hw2' into your cs202 directory:
          benjerry:~$ cd cs202
          benjerry:~/cs202$ cp -r ~schar/cs202/hw2 .
          benjerry:~/cs202$ cd hw2
    
    What to hand in:
    ./baseB2dec 2 1001
    ./baseB2dec 3 12021
    ./baseB2dec 8 177
    ./baseB2dec 16 177
    ./baseB2dec 16 abc
    
    ./dec2baseB 13 2
    ./dec2baseB 13 16
    ./dec2baseB 255 16
    ./dec2baseB 1001 11
    ./dec2baseB 16137787 31
    
  3. How much time did it take you to complete this assignment?