New features of C++
New features of C++ :-
Scope Resolution Operator :-
This operator can be used in situations where a global variable exist with the same name as a local variable.
Example :-
#include <stdio.h>
int xyz=50; // global variable
int main ()
{
for(register int xyz=1;xyz<10;xyz++)
// Here xyz is local variable
{
printf(“%d,::xyz/xyz”); //local variable
}
returnno();
}
In this code fragment the scope resolution operator is used to address a global variable instead of the local variable with the same name.
cout,cin and cerr :-
In analogy to C, C++ defines standard input and output strums which are opened when a program is executed. The strums are ----
· Cout analogues to stdout
· Cin analogous to stdin
· Cerr analogous to stderr
Syntactically these strims are not used with functions,instead,data are read from the strims or written to them using the operator <<, called the insercation and >> , called the extraction operator. The strims are declare in the header file <iostrim.h>
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment