13-10-2012, 11:26 AM
How to Build and Run a C++ program
Build and Run a C++.ppt (Size: 167 KB / Downloads: 23)
Streams Based IO
C++ features for handling I/O operations are called streams.
Streams refer to data flow.
It is transfer of information in the form of a sequence of bytes
Streams in c++ are classified into
input streams
output streams
Streams
Input: A stream that flows from an input device ( i.e.: keyboard, disk drive, network connection) to main memory
Output: A stream that flows from main memory to an output device ( i.e.: screen, printer, disk drive, network connection)
For standard input, use cin
For standard output, use cout
Inline functions
When a function is declared inline, the compiler copies the code of the function in the calling function i.e ,function body is inserted in place of function call.
Increases execution performance in terms of speed but needs more memory space.
To declare a function inline, keyword inline is preceded by function name.
Function with default arguments
We can call a function with lesser arguments than actual arguments.
Default arguments are used when function is invoked with fewer arguments than declared.
Default values are placed either in function prototype or in function definition.
Parameters without default arguments are placed first and then those with default arguments as C++ expects only the arguments on the right side can be defaulted.