Showing posts with label Module. Show all posts
Showing posts with label Module. Show all posts

Wednesday, March 15, 2017

C++ Part 25

Functions

  • Breaks code down into manageable chunks to write (and divide across development team)
  • Easier to debug – only one idea behind each module
  • Easier to maintain – buggy modules may be replaced without worrying about ramifications on other modules
  • Outsiders only need to know a module’s interface, not the details of its implementation.
  • Avoids duplication of code ⇒ more compact, and also easier to modify if code has bug  
  • Predefined functions: e.g., String.length(): String → Int  
  • Programmer-Defined functions: used similarly to predefined functions  

    This predefined functions need using namespace std;

Source : Absolute C++



Sunday, March 12, 2017

C++ Part 17

Boolean Expressions

A Boolean expression is any expression that is either true or false.


AND Example
(2 < x) && (x < 7)  
 

And Example with IF AND ELSE
if ( (score > 0) && (score < 10))
cout << "score is between 0 and 10.\n";
else
cout << "score is not between 0 and 10.\n";  

 
OR Example
(y < 0)||(y < 12)  
Precede Order:

If one operation is performed before another, the operation that is performed first
is said to have higher precedence.

Saturday, March 11, 2017

Intro to C++ Part 4


  • Declaration of variables: How does the variable map onto memory? Updating variable: How do we update the variable, and what do we update it with? 
  • I/O: How do we input and output data into the system? 
  • Control: How do we control which statement gets executed next? 
  • Modularity and Object Orientation: How do we organize the program to enable proper software engineering practices? 
  • Comments: Used to describe code; ignored by compiler, but code unmaintainable without good comments! C/C++: on line beginning with // or surrounded by /*, */

Digital Design Part 3

4th→ assembler translates it to the machine language. 1.6 [20] <§1.6> Consider two different implementations of the same instru...