Confusion with setfill() and fill().....In CPP | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Confusion with setfill() and fill().....In CPP

In CPP I have seen the use of both and know why they are used but why is setfill() (Iomanip class function) used without creating an object (and how can you use a function without declaring the object first?) while for using the fill() (iostream class function) we have to use the predefined iostream objects like cout......? cout<<fill(10)<<"Hello"<<endl; cout.setfill(10); cout<<"Hello"<<endl;

12th Feb 2018, 4:04 PM
3D CrackerJack
3D CrackerJack - avatar
0 Answers