I need to be able to store 5000 names into an array. I currently have a...

80.2K

Verified Solution

Question

Programming

I need to be able to store 5000 names into an array. I currentlyhave a code that generates one random name. I just need to generatean array of 5000 the same way.

#include
#include
#include
#include

using namespace std;

string RandomFirstGen(int namelength);

int main(){

srand(time(NULL));
int namelength = rand()%(16-8+1)+8;
cout<<\"name is:\"<

return 0;
}

string RandomFirstGen(int namelength){
for (int i=0; i<=5000 ; i++){
const int MAX = 26;
char alphabet[MAX] = {
'a', 'b', 'c', 'd', 'e', 'f', 'g',
'h', 'i', 'j', 'k', 'l', 'm', 'n',
'o', 'p', 'q', 'r', 's', 't', 'u',
'v', 'w', 'x', 'y', 'z'};
string name = \"\";
for (int i = 0; i < namelength; i++)
name = name + alphabet[rand() % MAX];
return name;

}
}

Answer & Explanation Solved by verified expert
3.6 Ratings (603 Votes)
include include include include using namespace    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students