Writing your own Manipulator function





This video tutorial teaches you how to build your own manipulator function in your program and use it.
You will learn what is the syntax to write a manipulator function, how to use custom built manipulator function in your program in detail with example.

source code for this tutorial

#include <iostream>
#include <iomanip>
using namespace std;

ostream &rightArrow(ostream &output){
output << " cool name man ---> ";
return output;

}

istream &getName(istream &input){
    cout << "enter your name please"<<endl;
    return input;
}


int main()
{
string name;
cin >> getName >> name;
cout << rightArrow << name;
return 0;

}

 
Back To Top