ADVERTISEMENT
ADVERTISEMENT

Home » C+ solved programs » C++ Manipulators programs

C++ program to demonstrate example of setfill manipulator

This program will demonstrate example of setfill manipulator in c++ programming language.

setfill manipulator program in C++



/*C++ program to demonstrate example of setfill manipulator.*/
 
#include <iostream>
#include <iomanip>
using namespace std;
 
int main()
{
    char pName[3][30]={"Dove Soap","Colgate","Vim"};
    int  qty[3]  ={5,10,15};
    int  i;
     
    cout << setw(30) << "Product Name" << setw(20) << "Quantity" << endl;
    for(i=0; i< 3; i++){
        cout << setw(30) << setfill('-') << pName[i] << setw(20) << setfill('#') << qty[i] << endl;
    }
    return 0;
}

Output

                  Product Name            Quantity
---------------------Dove Soap###################5
-----------------------Colgate##################10
---------------------------Vim##################15
ADVERTISEMENT



ADVERTISEMENT



Comments and Discussions


ADVERTISEMENT

ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.