I need some help with IO manipulators...

hello, I'm a noob in C++ and I need some help with alignment..

the output should look like this...

http://www.flickr.com/photos/miku-chii/7934834992/in/photostream

and I tried doing this:
...

cout<<"PAYSLIP"<<endl;
cout.setf(ios_base::fixed,ios_base::fl…
cout.precision(2);
cout.setf(ios::left,ios::basefield);
cout<<setw(20)<<"Regular Pay:";
cout<<setw(20)<<regpay<<endl;
cout<<setw(20)<<"Overtime Pay:";
cout<<setw(20)<<otpay<<endl;
cout<<setw(20)<<"Gross Pay:";
cout.setf(ios::right,ios::basefield);
cout<<setw(20)<<gpay<<endl;
cout<<"Deductions:"<<endl;
cout.setf(ios::left,ios::basefield);
cout<<setw(20)<<"\tTax";
cout<<setw(20)<<tax<<endl;
cout<<setw(20)<<"\tSSS";
cout<<setw(20)<<sss<<endl;
cout<<setw(20)<<"\tPhilHealth";
cout<<setw(20)<<ph<<endl;
cout<<setw(20)<<"\tPagibig";
cout<<setw(20)<<pibig<<endl;
cout<<setw(20)<<"Less: Deductions:";
cout.setf(ios::right,ios::basefield);
cout<<setw(20)<<deduct<<endl;
cout.setf(ios::left,ios::basefield);
cout<<setw(20)<<"Net Pay:";
cout.setf(ios::right,ios::basefield);
cout<<setw(20)<<netpay<<endl;
cout<<endl<<endl;
...

and the problem is that my output ends up like this:

http://www.flickr.com/photos/miku-chii/7934834732/in/photostream/

is there something wrong with this?
cout.setf(ios::left,ios::basefield);
it doesn't seem to work.. the output I end up with is all aligned to the right..
I also tried using this..
cout.setf(ios_base::left,ios_base::basefield);
but it doesn't make any difference..

thanks in advance! :D
Topic archived. No new replies allowed.