Set fill() for string output
#include <iostream> using namespace std; int main() { cout << "Hello" << endl; // Now set the width and the fill character. cout.width(10); cout.fill('*'); cout << "Hello" << endl; return 0; }