setfill function

HI is there alternate simple way for the following code to get printed.

1
2
3
cout<<"___________________________________________________________________"<<endl;
cout<<left<<"First name Last name Number of books bought Amount (in $)"<<endl;
cout<<"___________________________________________________________________"<<endl;


How to use setfill function for the line 1 and 3 and only for the line 1 and 3.

thanks
@vichu8888

1
2
3
4
5
6
7
8
9
#include <string>

string Line(70,'_'); // Change number to how long the underline will be. 
// Change variable Line, to whatever you want the name to be.
// And lastly, change the '_', to whatever you want printed. Only one character, though

cout << Line << endl;
cout<<left<<"First name Last name Number of books bought Amount (in $)"<<endl;
cout << Line << endl;

thats a great idea.
it helps a lot

Thank you whitenite1
Topic archived. No new replies allowed.