Made a little program that makes a random password using a simple algorithm, going to add number into the equation later but for now, this is simple and will get people going in the right direction if they wanted to make something sort of like this. Feel free to use this code as long as you give credits
Thanks,
- Programmer
Code:
#include <iostream>
#include <string>
#include <windows.h>
#include <ctime>
using namespace std;
void clrscr()
{
HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
COORD coord = {0, 0};
DWORD count;
CONSOLE_SCREEN_BUFFER_INFO csbi;
GetConsoleScreenBufferInfo(hStdOut, &csbi);
FillConsoleOutputCharacter(hStdOut, ' ', csbi.dwSize.X * csbi.dwSize.Y, coord, &count);
SetConsoleCursorPosition(hStdOut, coord);
}
int main()
{
while (true)
{
clrscr();
srand(static_cast<unsigned int>(time(0)));
char lower[26] = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'y', 'x', 'z' };
char upper[26] = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'Y', 'X', 'Z' };
string password;
for (int n = 0; n <= 5; n++)
{
password = password + lower[rand() % 25] + upper[rand() % 25];
}
cout << "Your generated password:" << endl;
cout << password << endl;
cout << "Press 'enter' to generate another." << endl;
cin.get();
}
return 0;
}
Thanks,
- Programmer