C language code for password:
#include<iostream.h>
#include<conio.h>
#define MAX 500
void main()
{
char password[MAX];
char p;
int i=0;
printf("Enter the password:");
while((p=getch())!= 13)
{
password[i++] = p;
printf("*");
}
password[i] = '\0';
if(i<6)
printf("\nWeak password");
printf("\nYou have entered: %s",password);
getch();
}
C++ language code for password:
#include<iostream.h>
#include<conio.h>
#define MAX 500
void main()
{
char password[MAX];
char p;
int i=0;
clrscr();
cout<<"Enter the password:";
while((p=getch())!= 13){
password[i++] = p;
cout<<"*";
}
password[i] = '\0';
if(i<6)
cout<<"\nWeak password\n";
cout<<"You have entered:"<<password;
getch();
}
Comments
Post a Comment