I am trying to create a simple function that I can use for the header of my programs which will have my name, the date, and the program name. My name will always be the same and the date will always be 00-00-00 but the problem is if my program name is different the nice little box I have around my header will be offset depending on how many characters that line is. I am not sure if I explained that well but here is the code:

Code:
#include <string>
#include <iomanip>
using namespace std;

void printHeader(string prog, string date){
  int len1 = prog.length();
  int diff = 69 - len1;
  int space = diff/2;



  cout<<"\n\n";
  cout<<"+-------------------------------------------------------------------+\n";          
  cout<<"| = : = : = : = : = : = : = : = : = : = : = : = : = : = : = : = : = |\n"; 
  cout<<"|{}.-------------------------------------------------------------.{}|\n";      
  cout<<"|: |                                                             | :|\n";   
  cout<<"| :|=MyNameHere      ||  Created: "<<date<<" || Modified: 00-00-00=|: |\n";       
  cout<<"|: |                                                             | :|\n";
  cout<<"| :|"<<setw(space)<<prog<<setw(space)<<" |: |\n";
  cout<<"|{}.-------------------------------------------------------------.{}|\n";
  cout<<"| = : = : = : = : = : = : = : = : = : = : = : = : = : = : = : = : = |\n";
  cout<<"+-------------------------------------------------------------------+\n\n\n";
  }
basically I am trying to create a certain amount of spaces on each side of the 'prog' variable depending on the size of the variable so that my box will line up. This code here does not work but I think I am on the right track, can anyone help?

thanks