Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 18th, 2012  |  syntax: None  |  size: 0.76 KB  |  hits: 22  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #include<iostream.h>
  2. #include<conio.h>
  3. #include<string.h>
  4. #include<ctype.h>
  5. void main()
  6. {
  7.         char p[10],password[10];
  8.         int count[10],c=0;
  9.         clrscr();
  10.         input:
  11.         cout<<"Enter password in Uppercase only:-";
  12.         cin>>password;;
  13.         int m=strlen(password);
  14.         for(int i=0;i<m;i++)
  15.         {
  16.                 if(password[i]==tolower(password[i]))
  17.                 goto input;
  18.         }
  19.         for(i=0;i<10;i++)
  20.                 count[i]=0;
  21.         for(i=0;i<10;i++)
  22.         {
  23.                 for(int j=0;j<=i;j++)
  24.                 {
  25.  
  26.                         if(password[i]==password[j])
  27.                                 count[i]++;
  28.                         if(count[i]>1)
  29.                                 p[i]=password[i];
  30.                         else
  31.                                 p[i]='\0';
  32.  
  33.                 }
  34.         }
  35.         for(i=0;i<10;i++)
  36.         {
  37.                 cout<<p[i];
  38.                 if(p[i]=='\0')
  39.                         c++;
  40.  
  41.         }
  42.         if(c==10)
  43.                 cout<<"your password is ACCEPTED";
  44.  
  45.         else
  46.                 cout<<"is repeated so your password is  REJECTED";
  47.         getch();
  48. }