//Create a random 10 character password with the first character being a upper case letter. The remaining characters are random selections of Upper case
//letters, lower case letters, 9 digits and/or special characters (found only on the top row of your keyboard). Please exclude 0 and O's from being used.After generating the password, display the password to the user and ask them to enter the password until it is entered correctly. Once the password is entered correctly please display the message "Sign On now successful!".
#include <iostream>
#include <string>
#include <cstdlib>
#include <ctime>
using namespace std;
static const char alphanum[]= "123456789"
"!@#$%^&*"
"ABCDEFGHIJKLMNPQRSTUVWXYZ"
"abcdefghijklmnpqrstuvwxyz";
int size = sizeof(alphanum) - 1;
char password=alphanum[rand() % size];
int main()
{
//password size
int length = 3;
cout << "Your Password is ";
srand(time(0));
for (int i = 0; i < length; i++)
{
cout << alphanum[rand() % size];
}
{
cout << endl;
}
{
cout << "enter the provided password " << endl;
cin >> password;
if ((password = alphanum[rand() % size]))
cout << "works" << endl;
}
return 0;
}
emilio_3 0 Newbie Poster
ryantroop 177 Practically a Master Poster
emilio_3 0 Newbie Poster
ryantroop 177 Practically a Master Poster
emilio_3 0 Newbie Poster
rproffitt 2,662 "Nothing to see here." Moderator
ryantroop 177 Practically a Master Poster
emilio_3 0 Newbie Poster
emilio_3 0 Newbie Poster
emilio_3 0 Newbie Poster
emilio_3 0 Newbie Poster
ryantroop 177 Practically a Master Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.