Dec 13, 2011

Program : Using setfill Function

Program : Using setfill Function

Its Similar Function as setw() using iomanip header file in this we use both setw and setfill function. Its used to fill setw() left spaces with any character or symbols like last example : Hello  World using setfill('*') we can display Hello**World



Check the following Program for How its work

#include<iostream.h>
#include<conio.h>
#include<iomanip.h>
int main()
{

cout << "Hello"<<setw(7)<<setfill('*')<<"World";

/* Here Hello is print as its and setw(7) make 7 columns in which its store World value that take 5 column from right and two column is left blank so to fill that part with particular character or symbol like in this i fill that two blank space with * value So Output will Hello**World     
*/
getch();
return 0;
}

OUTPUT




0 comments:

Post a Comment