Mega Code Archive

 
Categories / C++ / Console
 

Custom cout output manipulator

#include <iostream> using namespace std; // Attention: ostream &atn(ostream &stream) {   stream << "Attention: ";   return stream; } // Please note: ostream &note(ostream &stream) {   stream << "Please Note: ";   return stream; } int main() {   cout << atn << "High voltage circuit\n";   cout << note << "Turn off all lights\n";   return 0; }