Teorija CPP: cestnoprometni predpisi: C, E, D – kat.: (za interno uporabo). Front Cover. Bojan Krajnc. B. Krajnc, – 89 pages. Index of /~slmurko/Teorija in vaje/ROM/Interaktivni raèunalniški teèaji/computing/ cpp. [ICO], Name · Last modified · Size · Description. [DIR], Parent Directory, -. Parent Directory, -. [TXT], BARCHART.C, Feb , K. [TXT], , Feb , K. [ ], , Feb , K.
|Published (Last):||19 July 2009|
|PDF File Size:||11.48 Mb|
|ePub File Size:||3.69 Mb|
|Price:||Free* [*Free Regsitration Required]|
Then you use the procedures of the module to modify each of your handles. The idea of this interface is as follows: The main program directly operates on global data. The resulting module structure is therefore oriented on the operations rather than the actual data. What we would like to have is a mechanism which allows us to specify on which data type the list should be defined. With procedural programming you are able to combine returning sequences of statements into one single place.
Data specifies valid operations. For a simple data structure like the singly linked list one can think of only one traversing strategy.
This implies a traversing strategy which defines the order in which the elements of the data structure are to be visited. Instead of calling a procedure which we must provide with the correct list handle, we would directly send a message to the list object in question. You choose the data representations which best fit your requirements. This handle is used in every provided procedure to uniquely identify the list in question.
For example a queue can be structured like a singly linked list. The following two procedures implement the mentioned access methods append and delete.
It is in your responsibility to ensure that your list is used consistently. You all know singly linked lists which use a very simple structure, consisting of elements which are strung together, as shown in Fig.
However, the example implies some problems which we will outline now. Structure of a singly linked list. On creation fpp a feorija should be initialized to be empty. Consider the multiple lists example again. Singly linked lists just provides access methods to append a new element to their end and to delete the element at the front.
Index of /~murkos/Teorija in vaje/LAV/Software_145/KRMILJA/PIC/HT-C/BIN
Each such object can be uniquely identified by its handle and only those methods are applicable which are defined to operate on teorijx handle. In our list example we have to use the special type ANY to allow the list to carry any data we like.
For example, if a procedure is correct, every time it is used it produces correct results. Therefore it would be nice to declare a new list with something like:.
Ciklopropan — Википедија, слободна енциклопедија
We can illustrate this as shown in Fig. Usually, people start learning programming by writing small and simple programs consisting only of one main program. This enables you to change the implementationfor example to use a faster but more memory consuming algorithm for storing elements without the need to change other modules of your program: The list example implies operations to traverse through the list.
Each module can have its own data. A code frame for this would look like this:. Since this example is just used to illustrate these concepts and problems it is neither complete nor optimal. A procedure call is used to invoke the procedure. The compiler should be able to check for type consistency.
Teotija advantage is, that now the compiler takes care of calling initialization and termination procedures as appropriate. Now modules group data representations together. Several data structures exist, for example lists, trees, arrays, sets, bags or queues to cop a few. The calls to provided procedures remain the same. Our interface definition might then look similar to that below:. If you want to use a list within a procedure, say, foo you use the following code frame:.
But what, if you need more than one list in one of your programs?
For example, if the same statement sequence is needed at different locations within the program, the sequence must be copied.