Cryptography Reference
In-Depth Information
calculate the two-part of a LINT object
Function:
int
LINT::twofact (LINT& b);
Syntax:
implicit argument a
Input:
b (odd part of a )
Output:
exponent of the even part of a
Return:
e = a.twofact (b);
Example:
15.3 Stream I/O of LINT Objects
The classes contained in the C++ standard library such as istream and ostream
are abstractions of input and output devices derived from the base class ios .The
class iostream is in turn derived from istream and ostream , and it enables both
writing and reading of its objects. 1 Input and output take place with the help of
the insert and extract operators “ << ”and“ >> ” (cf. [Teal], Chapter 8). These arise
through overloading the shift operators, for example in the form
ostream& ostream::operator<< (int i);
istream& istream::operator>> (int& i);
in which they enable output, respectively input, of integer values through
expressions of the form
cout << i;
cin >> i;
As special objects of the classes ostream and istream , cout and cin represent the
same abstract files as the objects stdout and stdin of the standard C library.
The use of the stream operators “ << ”and“ >> ” for input and output makes
it unnecessary to consider particular properties of the hardware in use. In and
of itself this is nothing new, for the C function printf() behaves the same way:
A printf() instruction should always, regardless of platform, lead to the same
result. However, above and beyond the altered syntax, which is oriented to the
metaphorical image of the insertion of objects into a stream, the advantages of
the C++ implementation of streams lie in the strict type checking, which in the
case of printf() is possible only to a limited degree, and in its extensibility. In
particular, we make use of the latter property by overloading the insert and extract
1
We use this name of the stream classes as a synonym for the terms now used in the C++
standard library, with which the class names known up to now are prefixed with basic_ . The
justification for this comes from the standard library itself, where the class names known
hitherto are provided with corresponding typedef s (cf. [KSch], Chapter 12).
 
Search WWH ::




Custom Search