Fill-function-in-C++ .

In this session i have discuss fill function in C++ .

In some case when you will set the width of field , It is larger than given value on that case the unused position are filled with white space . However we can use the fill() to fill the unused position by desired character .

Fill() syntax


Where * is the desired character .

Example : Write a program that demonstrate the fill function .

    using namespace std;
    int main()
         return 0;
    OUTPUT : ****1234

The above program we have specify * character in fill() . Which is fill the first four position with * .

Welcome to AndroidATPoint.

back image                     next image