3: Problem Statement:
Set A=(1,3, a, s, t, i} represent alphanumeric characters permitted to set the password of length 4. Write C/C++ program to generate all possible passwords.
#include<iostream>
using namespace std;
class passowrd
{
char setA[6]={'1','3', 'a', 's', 't', 'i'};
public :
void combinations();
};
void passowrd::combinations()
{
for(int i=0;i<6;i++)
{
for(int j=0;j<6;j++)
{
for(int k=0;k<6;k++)
{
for(int l=0;l<6;l++)
{
cout<<setA[i]<<setA[j]<<setA[k]<<setA[l];
cout<<"\n";
} } }
}
}
int main()
{
passowrd p;
p.combinations();
}
Comments
Post a Comment