one way to do so is this

Code:
#include<iostream>
#include<string>
#include<ctime>
using namespace std;
int main()
{
 
int numofchar;
 srand(time(NULL));
 int which=rand()%10;   
string words [10] = {"blue","red","green","yellow","white","black","pink","orange","purple","brown"};
 string wordpicked=words[which];
 numofchar=wordpicked.length();
 
 char buffer[20];
 memset(buffer,'*',numofchar);
 buffer[numofchar]='\0';
  string wordBlanc(buffer);
 cout<<"word picked="<<wordpicked<<endl;

 cout<<"selected index="<<which<<endl;
 cout<<"length="<<numofchar<<endl;
 cout<<"word blanced is:"<<wordBlanc;
 cout<<"\n\n";   
system ("pause");    
return 0;    
}