
Untitled
By: a guest on
May 18th, 2012 | syntax:
None | size: 0.76 KB | hits: 22 | expires: Never
#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<ctype.h>
void main()
{
char p[10],password[10];
int count[10],c=0;
clrscr();
input:
cout<<"Enter password in Uppercase only:-";
cin>>password;;
int m=strlen(password);
for(int i=0;i<m;i++)
{
if(password[i]==tolower(password[i]))
goto input;
}
for(i=0;i<10;i++)
count[i]=0;
for(i=0;i<10;i++)
{
for(int j=0;j<=i;j++)
{
if(password[i]==password[j])
count[i]++;
if(count[i]>1)
p[i]=password[i];
else
p[i]='\0';
}
}
for(i=0;i<10;i++)
{
cout<<p[i];
if(p[i]=='\0')
c++;
}
if(c==10)
cout<<"your password is ACCEPTED";
else
cout<<"is repeated so your password is REJECTED";
getch();
}