CS13002 Programming and Data Structures

Section: 4/D, Spring 2005

Assignment 6

This exercise is based on string manipulation and handling of two-dimensional arrays. You are given a text file. Your problem is to adjust the spaces in each line in such a way that the resulting text is justified (both at the left and at the right). Here is our proposal of an algorithm that you should use in order to solve the problem.

The following should be the output of your program for the fourth paragraph of the input file.

   The  design  of  the  first commercially available mechanical calculator is
   attributed to Leibnitz (1671) (the same bloke who  invented  calculus).  It
   was  completed  in  1694  and  Leibnitz  demonstrated,  for the first time,
   that  binary  arithmetic  was  superior  to  decimal   arithmetic   as   it
   simplifies  machine  construction.  Leibnitz's machine could add, subtract,
   multiply, divide and even  find  square  root.  Leibnitz's  machine  was  a
   full  adder  (you'll  learn  about  a  full  adder in your Digital Hardware
   Design course), in which the carry was saved in the form  of  the  position
   of  a  lever.  A  working  model of this machine was exhibited at the Royal
   Society of  London  in  1794,  but  it  was  somewhat  unreliable.  It  was
   commercially available in 1820.


[Submission site] [Lab home] [Course home]