In my second version of my program that will help create a secure password for the user I am attempting to have it create an acronym from a phrase that the user types in. One problem that I am having is whenever I display the acronym it shows the acronym but then it shows some unprintable characters and then the phrase. What did I do wrong? Here is the quick code I wrote to do it so I haven't really worried about neatness for now.
using namespace std;
char again, phrase, acronym;
cout << "Enter phrase (40 character limit): ";
cin.getline(phrase, 40, '\n');
for (int i=0; i < 40; i++)
if (i == 0) //if it is the first letter of the phrase
acronym = phrase;
else if (phrase[i] == ' ') //if it is inbetween words use the first letter in the following word
acronym[c] = phrase[i+1];
cout << "Acronym is " << acronym << "\nAgain?: ";
cin >> again;
cin.ignore(80, '\n'); //just incase they typed in 'yes', 'Yes', 'YES'...
} while (again == 'y' || again == 'Y');