Функции: < /p>
Два случайных слова: < /p>
Код: Выделить всё
string addWords(string oldPassword)
{
ifstream file("word.txt");
int times = 0;
while (times < 2) {
int number = rand() % 1000; // Random number between 0 and 999 (for 1000 lines)
string word = "";
// Reset the file pointer to the beginning of the file
file.clear();
file.seekg(0, ios::beg);
// Skip to the random line (based on the random number)
for (int i = 0; i < number; ++i) {
getline(file, word); // Read each line until we reach the random line
}
// Append the word to the oldPassword
oldPassword += "-" + word;
times += 1;
}
file.close();
return oldPassword;
}
< /code>
3 случайные цифры < /p>
string addDigits(string oldPassword)
{
for (int i = 0; i
Тогда три случайных символа: < /p>
string addSymbols(string oldPassword)
{
string randomSymbols = "!$%^&*()[{]}#~@;:/?.>,
Подробнее здесь: [url]https://stackoverflow.com/questions/79606625/c-not-outputing-as-expected-when-compiled-but-does-when-run-in-visual-studio[/url]
Мобильная версия