ユーザーがいくつかの名前を入力すると、ランダムな名前が選択されるプログラムを作成したいと考えています。しかし、文字列を選択する方法がわかりません。すべての文字列をintに割り当てたいのですが、intが選択されると、文字列も選択されます。私を助けてください。
#include <iostream>
#include <ctime>
#include <cstdlib>
#include <string>
using namespace std;
void randName()
{
string name;//the name of the entered person
cout << "write the names of the people you want.";
cout << " When you are done, write done." << endl;
int hold = 0;//holds the value of the number of people that were entered
while(name!="done")
{
cin >> name;
hold ++;
}
srand(time(0));
rand()&hold;//calculates a random number
}
int main()
{
void randName();
system("PAUSE");
}