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.
Once you leave the scope for example the procedure where the integer was defined the integer is lost. To enable usage of xpp procedures or groups of procedures also in other programs, they must be separately available. Object-oriented programming solves some of the problems just mentioned. After the sequence is processed, flow of control proceeds right after the position where the call was made Fig.
The list example implies operations to traverse through the list.
Several data structures exist, for example lists, trees, arrays, sets, bags or queues to name a few. We can illustrate this as shown in Fig. For example, if a procedure is correct, every time it is used it produces correct results.
Index of /~murkos/Teorija in vaje/LAV/Software_145/KRMILJA/TC/BIN
Programs use data structures to store data. Some compilers even initialize newly created integers to a specific value, typically 0 zero. However, this implies more overhead and does not prevent you from knowing what teorlja are doing.
You hide information of the actual implementation information hiding. Therefore it would be nice to declare a new list with something like:. However, the example implies some problems which we will outline now. You then use these operations by providing explicitly the data to them on which they should operate. Consequently, there is no longer the need to explicitly call a creation or termination procedure.
Usually, people start learning programming by writing small and simple programs consisting only of one main program. Traversing can be done using the following loop:.
As you believe that lists are a common data structure, you decide to implement it in a separate module. The following two procedures implement the mentioned access methods append and delete. What we would like to have is a mechanism which allows us to specify on which data type the list should be defined.
C++ Tutorial – Chapter 6
Complex data structures might use already existing ones. It is now divided into several smaller parts which interact through procedure calls and which form the whole program Fig. You therefore create a new interface description which now includes a definition for a list handle.
Decoupling of data and operations leads usually to a structure based on the operations rather than the data: 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: This implies a traversing strategy which defines the order in which the elements of the data structure are to be visited.
If you want to use a list within a teorja, say, foo you use the following code frame:.
This chapter is organized as follows. This has lead to the idea to extract these sequencesname them and offering a technique to call and return from these procedures. The main program is responsible to pass data to the individual calls, the data is processed by the procedures and, once the program has finished, the resulting data is presented.
It is in your responsibility to ensure that your list is used consistently.
Now you have a list module which allows you to use a list with any type of data elements. Consequently, your programs get structured by the data rather than operations. With procedural programming you are able to combine returning sequences of statements into one single place.
Beginning with the next chapters additional features of object-orientation are introduced which makes object-oriented programming to a new programming teorijja. A program therefore no longer consists of only one single part.
With modular programming procedures of a common functionality are grouped together into separate modules. We will investigate this in more detail in chapter What we have shown with the traversing strategy applies to other strategies as well. However, there is only one state per module and each module exists at most once in the whole program.
Ciklopropan — Википедија, слободна енциклопедија
The advantage is, that now the compiler takes care of calling initialization and termination procedures as appropriate. Consider the following example which the compiler cannot check for correctness:. Fortunately, it is not. Once you’ve defined them, you can use them. For example, if the same statement sequence is needed at different locations within the program, the sequence must be copied.