Plan jest taki:
Po wykonaniu instrukcji:
#include <iostream>
#include <iomanip>
//--------------POLECENIE DO WYKONANIA
cout<<setw(9)<<setfill('-')<<centruj()<<"xXx"<<endl;
Gdzie centruj() to mój manipulator który jest realizowany jako klasa:
//----------MÓJ MANIPULATOR OSTREAM
class centruj
{
public:
int arg;
//--------------------
centruj(int a=0):arg(a){}
//--------------------
void zrobto(ostream &os) const
{
//<------BRAK POMYSLU NA REALIZACJE TEGO PLANU...
}
};
//----------OSTREAM
ostream& operator<<(ostream& strum, centruj const & manipulator)
{
manipulator.zrobto(strum);
return strum;
}
Ma zostać wyświetlony na ekranie wycentrowany tekst czyli w tym przypadku:
---xXx---
Proszę o rozwiązanie, dodatkowo mogą być też jakieś rady, sugestie, unowocześnienia.