Home » » Fill ( Charachter )

Fill ( Charachter )

Written By Unknown on Senin, 23 Januari 2012 | 01.29

Lab RPL .
Sets the character that will be used in output that has a width larger than expression needs. Using the example above , Let's add another line of code to the program that use fill :
#include <iostream.h>
int main ( )
{
cout<< " Hi" ;
cout.widht (11);
cout.fill ("-") ;
cout<< " Bye ";
return 0 ;
}

The Fill ( ) function will accept a character as its parameter and will use it to fill the unused spaces from the string. Here , There are 7 dashes that are used . This is the Output :
           Hi-------------Bye

With the cin class, there are member functions that deal with input.

0 komentar:

Posting Komentar