You are on page 1of 5

#include<iostream>

#include<string.h>

#include<conio.h>

#include<stdlib.h>

#include<stdio.h>

#include<windows.h>

using namespace std;

void gotoxy(int x, int y)

static HANDLE h = NULL;

if(!h)

h = GetStdHandle(STD_OUTPUT_HANDLE);

COORD c = { x, y };

SetConsoleCursorPosition(h,c);

struct MEMBER

char name[20];

char password[15];

int number[10];

};

int main()

char A[20];
MEMBER m;

system("COLOR F0");

cout.width(50);

cout << "REGISTRATION:" << endl << endl;

cout.width(40);

cout << "NAME : ";

cout << endl << endl;

cout.width(40);

cout << "PASSWORD : ";

cout << endl << endl;

cout.width(40);

cout << "RE-ENTER PASSWORD : ";

cout << endl << endl ;

gotoxy(42,2);

cin.getline(m.name,20);

gotoxy(42,4);

char c;

int h=0;

c=getch();

while(c!=13 && h<15)

if(c!=8)

cout << "*";

m.password[h]=c; //WE ASSUME THAT INITIALLY HE DOESN'T PRESS BACKSPACE;

h++;

}
if(c==8)

if(h!=0)

cout << c;

cout << " ";

cout << c;

h--;

if(h==0)

c=getch();

gotoxy(42,6);

h=0;

c=getch();

char verify[20];

while(c!=13 && h<15)

if(c!=8)

cout << "*";

verify[h]=c; //WE ASSUME THAT INITIALLY HE DOESN'T PRESS BACKSPACE;

h++;

if(c==8)
{

if(h!=0)

cout << c;

cout << " ";

cout << c;

h--;

if(h==0)

c=getch();

int n=strcmp(verify,m.password);

int i=1;

while(n!=0 && i<=3)

system("cls");

cout.width(50);

cout << "REGISTRATION:" << endl << endl;

cout.width(53);

cout << "PASSWORD MISMATCH!!" << endl;

cout.width(50);

cout << "FILL AGAIN.." << endl;


}

cin.get();

cin.get();

You might also like