Define operator for cout
#include <iostream> #include <iomanip> using namespace std; ostream &ra(ostream &stream) { stream << "--> "; return stream; } ostream &la(ostream &stream) { stream << " <--"; return stream; } int main() { cout << "AAA" << ra << 33.23 << endl; cout << "BBB" << ra << 67.66 << la; return 0; }