Code:
int main()
{
string addy1 = getAddy();
cout << "How many addies are req'd? : "; // tells the program how many addies to generate
int reqd;
cin >> reqd;
cin.ignore();
for (int i=0; i < reqd; i++) {
string addy = randomize(addy1);
ofstream addies ("addies.txt", ios::app);
if (addies.is_open()) {
addies << addy << ", ";
addies.close();
}
Well if only commas are being printed then addy (the blue line) must be an empty string. If that is the case then randomize() must have returned an empty string (the green line). If that is the case, it must have been passed an empty string; if that is the case then getAddy() must have returned an empty string. If that is the case then you likely entered an empty string.
Unless . . .
Code:
string randAddy; //
/* string usedAddies; //
ifstream used_addies ("addies.txt"); // Makes sure that no two addies
while (! used_addies.eof()) { // generated are the same.
getline(used_addies, usedAddies); } //
used_addies.close(); //
*/ stringstream str_randAddy; //
for (int i=1; i < len; i++) {
if (rand() < HIGH * 0.15) {
randAddy[i] = toupper(addy[i]); // Capitilize some random characters
}
}
What if the highlighted if statement is false? randAddy[i] wouldn't be set to anything. I suggest putting
Code:
else randAddy[i] = addy[i];
or initializing randAddy to addy.
BTW you shouldn't use goto. You can get by with just loops.