Thursday, December 4, 2014

cs Sep 17, 2014



Separate interface concerns with implementation.

interface : how to use libraries of functions (created by the systems programmers for use by application programmers)


Implementation : details of how it is implemented
data hiding (detail)

encapsulation : put the data and the functions that manipulate that data into objects.

instances of classes into objects.

---> download texlive.img , the new zip .check whether the .mp file would be deleted ... and the .cpp.
Chp 4 : 

Review :
20. organization of code, simplify, reuse/modify (source code, component .net), flexibility, efficiency, modularization
21. what you can do to an int that you cannot do to a string (switch,  -- case values need to be constant exprs)

case constexpr

int  -- concrete (finite values )

Integer --> Absract  (infinite values)

++ 

22. What you can do to a string that you cannot do to an int. s1.substr(pos,numofchar)
24. for (int i = 0; i <name.size(); i++)
              cout << name[i] ;

  name.operator[](i) ;

  array is a function : mapping an input value to an output value.

for (auto x: name)
  cout << x;

25. vector<char> alphabet(26)
initialized ot "" for string and 0 for int.

pushback appends at the end of the vector

vector<int> v1[6]; // array of 6 vectors each of which is empty with no elements..

while(true)  // infinite loop that does nothing
 ;
for (;;)
  ;

for(initialize/assignment/definition;condition;update)
  ;

Scope : what does scope mean:
26. adds a value to the end of the vector..
Adds a new element at the end of the vector, after its current last element. The content of val is copied (or moved) to the new element.

This effectively increases the container size by one, which causes an automatic reallocation of the allocated storage space if -and only if- the new vector size surpasses the current vector capacity.

creates a whole new vector which has a size of +1 than the older one.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home