A user-defined manipulator is a function which can be passed as an argument to the stream insertion or extraction operator overloads. For example, the output stream insertion operator has the following overload:
std::ostream& operator<< (std::ostream& st, std::ostream& (*func) (std::ostream&));
The second argument is the function pointer, with the following signature:
std::ostream& (*func) (std::ostream&)
Any function that matches this signature can be used as a manipulator. For instance, the following user-defined manipulator does exactly the same job as the std::endl manipulator:
std::ostream& my_manipulator (std::ostream& os)
{
return os << '\n' << std::flush;
}
Example usage:
std::cout << "Hello world!" << my_manipulator;
You can, of course, provide your own implementations to perform any type of manipulation. For example, suppose you want a manipulator that inserts an elipses into an output stream:
std::ostream& elipses (std::ostream& os)
{
return os << "...";
}
Example usage:
std::cout << "Hello" << elipses << "world!" << my_manipulator;
Output:
Hello...world!
Absolutely. Indeed, any function (user-defined or built-in) that does not return a value is not really a function, it is simply a procedure.
The C standard library IO facilities are not extensible. For instance, the printf() and scanf() functions cannot handle user-defined types. However, the C++ standard library provides IO streams with insertion and extraction operators (<< and >>) that can be overloaded to support any user-defined type.
to create user defined functions the user defined data is needed nd its useful to the programmer to create its own data.
clear() is an inbuilt function defined in c++ defined in conio.h. It is used for clearing the console. The systax is:clear();
More user friendly than what? Please restate the question.
Use "typedef" : both in C and C++.
theriyadhu
Absolutely. Indeed, any function (user-defined or built-in) that does not return a value is not really a function, it is simply a procedure.
Manipulators are functions that change the formatting parameters on character streams.
main is predeclared and user defined.
The C standard library IO facilities are not extensible. For instance, the printf() and scanf() functions cannot handle user-defined types. However, the C++ standard library provides IO streams with insertion and extraction operators (<< and >>) that can be overloaded to support any user-defined type.
to create user defined functions the user defined data is needed nd its useful to the programmer to create its own data.
The C++ standard library contains all the pre-defined functions.
There is no such exception in C++. It's probably a 3rd party or user-defined exception. Examine the call-stack to determine where the exception was caught -- that should help you determine where the exception was thrown.
clear() is an inbuilt function defined in c++ defined in conio.h. It is used for clearing the console. The systax is:clear();
More user friendly than what? Please restate the question.
There is no such keyword or data type known as tbuffer in C++. It's most likely an user-defined identifier, possibly a text buffer. But without knowing its actual type or its context it's impossible to say what it means.