Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<conio.h>
- void splashscreen();
- void authentication();
- void makeBox(int, int, int, int, int);
- void scanPassword(char *, int);
- void main()
- {
- splashscreen();
- authentication();
- getch();
- }
- void splashscreen()
- {
- textbackground(BLUE);
- clrscr();
- //textcolor(WHITE);
- makeBox(15,6,47,5,4);
- textcolor(GREEN);
- gotoxy(18,8);
- cprintf(" B U S T I C K E T I N G S Y S T E M ");
- makeBox(38,22,40,10,3);
- makeBox(42,21,13,2,3);
- textcolor(WHITE);
- gotoxy(43,22);
- cprintf("Information");
- textcolor(WHITE);
- gotoxy(40,25);
- cprintf("Submitted by:");
- gotoxy(40,26);
- cprintf("Submitted to:");
- gotoxy(40,27);
- cprintf("Course: ");
- gotoxy(40,28);
- cprintf("Module: ");
- textcolor(YELLOW);
- gotoxy(55,25);
- cprintf("Falano");
- gotoxy(55,26);
- cprintf("Dhiskano");
- gotoxy(55,27);
- cprintf("IDITC");
- gotoxy(55,28);
- cprintf("C Programming (CPG102)");
- textcolor(RED+BLINK);
- gotoxy(25,35);
- cprintf("Press any key to continue..");
- textcolor(WHITE);
- _setcursortype(_NOCURSOR);
- getch();
- }
- void authentication()
- {
- char username[50], password[50];
- textbackground(BLUE);
- clrscr();
- makeBox(38,18,25,8,2);
- textcolor(YELLOW);
- gotoxy(40,20);
- cprintf("USERNAME: ");
- gotoxy(40,22);
- cprintf("PASSWORD: ");
- _setcursortype(_SOLIDCURSOR);
- gotoxy(52,20);
- scanf("%s",username);
- gotoxy(52,22);
- //scanf("%s",password);
- scanPassword(password,14);
- gotoxy(52,40);
- cprintf("Username : %s Password : %s",username, password);
- }
- void makeBox(int x, int y, int width, int height, int color)
- {
- int i,j;
- textcolor(color);
- //top left corner
- gotoxy(x,y);
- cprintf("%c",218);
- //top right corner
- gotoxy(x+width, y);
- cprintf("%c",191);
- //bottom left corner
- gotoxy(x,y+height);
- cprintf("%c",192);
- //bottom right corner
- gotoxy(x+width, y+height);
- cprintf("%c",217);
- for(i=x+1;i<x+width;i++)
- {
- //for top line
- gotoxy(i,y);
- cprintf("%c",196);
- //for bottom line
- gotoxy(i,y+height);
- cprintf("%c",196);
- }
- for(j=y+1;j<y+height;j++)
- {
- //for left line
- gotoxy(x,j);
- cprintf("%c",179);
- //for right line
- gotoxy(x+width,j);
- cprintf("%c",179);
- }
- }
- void scanPassword(char *pass, int color)
- {
- char input[50];
- char in;
- int count=0;
- textcolor(color);
- do
- {
- in=getch();
- if(in==13 && count>0)
- {
- break;
- }
- else if(in==8 && count>0)
- {
- printf("%c%c%c",8,32,8);
- count--;
- }
- else if(in==27)
- {
- splashscreen();
- }
- else if(in!=13 && in!=8 && in!=27)
- {
- input[count]=in;
- cprintf("#");
- }
- else
- {
- continue;
- }
- count++;
- }while(count<50);
- input[count]='\0';
- strcpy(pass,input); //copy the value of input in pointer pass
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement