Lab 2 (but kind of 1)

ADA

This lab must be done in the Ada programming language.
I gave out examples of Ada in class on Friday, there are many other resources on the Web and the library has a few books on Ada (one written by Ross and Starkey).

Team work

You can work in teams of the amount that Tim Gradl set up, I can't remember if it's two or three to a team. It shouldn't be more than two really.

To Do

Assume for the moment that your computer has the very limited capability of being able to read and display only a single decimal digits at a time and to add together two integers consisting of one decimal digit each. Write a program to read in two integers of up to ten digits each, add these numbers together, and display the result. Test your program on the following numbers:
  X = 1487625
  Y =   12783

  X = 60705202
  Y = 30760832

  X = 1234567890
  Y = 9876543210

Hints

Store the numbers x and y in two arrays x and y of size 10, one decimal per array element (type character).
If the number is less than 10 digits in lenght, enter enough leading zeros (to the left of the number) to make the number 10 digits long.
  array X
  [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]
   0   0   0   1   4   8   7   6   2   5

  array Y
    [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]
     0   0   0   0   0   1   2   7   8   3

You will need a loop to add together the digits in corresponding array elements, starting with the element with subscript 10. Don't forget to handle the carry if there is one. You will need another variable to indicate whether you need to carry a 1.

Due

Due next Monday, Feb. 7th