see the code below
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];
cout<<"word picked="<<wordpicked<<endl;
numofchar=wordpicked.length();
cout<<"selected index="<<which<<endl;
cout<<"length="<<numofchar;
cout<<"\n\n";
system ("pause");
return 0;
}