Making an table with printf in c++ - Stack Overflow
You can use printf with left-justify flag (-). printf("%-10s", "title"); // this will left-align "title" in space of 10 characters Here is a sample program: #include using namespace std; int main() { string name = "Bob Cratchit"; string title = "Clerk"; ...