Why are you opening the files using string constants then defining c strings after?
You are defining Init to be an array of char (max value 255 for unsigned char) but then try to assign 9999 to an element?Code:infilef.open ("frstNames.txt"); infilel.open ("LstName.txt"); // // Give it a name so that you can print out a message. // You might want to change the name some day, so // define it in one place. // const char *inFname = "frstNames.txt"; const char *inLname = "LstNames.txt";
Also, you are defining string arrays then try to set an element to a number!Code:char *Init = new char[siz]; Init[siz - 1] = 9999;
Code:string *fstNames = new string[siz]; fstNames[siz - 1] = 1999;i is used to index the adds string array. This assumes they will always be 5 elements in the array. What hapens if more names are added to the array - or some removed?Code:for (i = 0; i < 5; ++i) { //i for email prvdrs count ex: abcathotmaildotcom
You are defining the maximum number emails generated as 10 million. But what happens if the user enters say 20 to generate 20 million addresses? You could first ask for the number and then allocate the arrays as needed.
Code:cout << "Enter the number of email addresses you want to create: (IN MILLIONS) " ; cin >> n; n *= 1000000; char *Init = new char[n]; //etc etc




Reply With Quote