Lecture 11 – October 3rd

For the rest of the semester we will meet in ISAT/CS 250 (the lab) not in ISAT/CS 243

 

Today we worked with Ada’s access variables

 

Here is a more elegant example of the problem we solved in class –

You MUST study THIS code  (rather than the examples you or I created in class)

            First we created a filled a cell

            Then we created a filled a second cell

            Then we attached the two cells with the newer one at the end

            Then we printed the list

            Then we created a new cell

            Then we inserted the new cell at the head of the list

            Then we printed the list

 

Here’s what you MUST do for homework for Thursday, October 5th

  • SUBMIT these as yourname12 and yourname13 
  • Create a similar program only put the third node between the first two  (yourname12.adb)
  • Create a similar program only put the third node at the end of the list (yourname13.adb)

NOTE:

  • Since they are single .adb files you do NOT have to zip them. Please do NOT zip them.  Submit them as two separate .adb files.  Thank you
  • Please pay particular attention to the comments in the code I asked you to study.  Your program should have similar comments (type of comment and number of comments)

 

Here’s what you SHOULD do

Insert things in a 4 or 5 element list in different places and print the lists

 

NOTE: 

  • We only needed a single extra pointer to print the lists.
  • When you want to insert things in the middle of a list you need two pointers (previous and current) in order to be able to insert things in the correct place.